IT Placement Papers Programming C
This category contains C Interview Questions and Answers |
What is NULL and how is it #defined?
|
|
|
|
|
As a matter of style, many programmers prefer not to have
unadorned 0's scattered through their programs. Therefore, the
preprocessor macro NULL is #defined (by or )
with the value 0, possibly cast to (void *) A programmer who wishes to make explicit the distinction
between 0 the integer and 0 the null pointer constant can then
use NULL whenever a null pointer is required.
Using NULL is a stylistic convention only; the preprocessor
turns NULL back into 0 which is then recognized by the compiler,
in pointer contexts.
Only registered users can write comments. Please login or register.
|