Is the NULL pointer same as an uninitialised pointer?
Answer: B
Correct answer: No
A null pointer holds a defined value that compares unequal to any valid address, so it can be tested with if (p) and used as a sentinel. An uninitialised pointer holds whatever happened to be in memory, so it cannot be tested meaningfully and dereferencing it is undefined. Confusing the two is why uninitialised pointers should always be set to NULL explicitly.
Please log in or register to report this question.