+ 2

What is the value of null? and why?

12th Sep 2017, 8:56 AM
Suyog Naikwade
Suyog Naikwade - avatar
7 Answers
+ 3
The random value is due to a section of memory being asigned to the declared variable. That section of memory may have any combination of 0 and 1 as these bits have not been overwritten. But null per se does not represent a random value.
12th Sep 2017, 10:50 AM
spcan
spcan - avatar
+ 2
Null has no value. When asigned to a variable, it indicates the absence of value of that variable. That variable will be declared and accessible but it stores nothing
12th Sep 2017, 9:01 AM
spcan
spcan - avatar
+ 2
In C and C++, NULL is 0.
12th Sep 2017, 10:55 AM
Schindlabua
Schindlabua - avatar
+ 2
@Schindlabua thanks for pointing that out. In the languages I know well it works that way. So it may vary between languages
12th Sep 2017, 11:00 AM
spcan
spcan - avatar
+ 1
generally it is said that null has no value , but that's not the truth , its an indeterminate random value .
12th Sep 2017, 10:43 AM
RZK 022
RZK 022 - avatar
+ 1
That is true. It does actually have a random value but it still represents absence.
12th Sep 2017, 10:45 AM
josh mizzi
josh mizzi - avatar
0
Null simply means the absence of a value.
12th Sep 2017, 10:40 AM
josh mizzi
josh mizzi - avatar