As a matter of style, many people prefer not to have unadorned 0's scattered throughout their programs. For this reason, the preprocessor macro NULL is #defined (by or ), with value 0 (or (void *)0, about which more later). A programmer who wishes to make explicit the distinction between 0 the integer and 0 the null pointer can then use NULL whenever a null pointer is required. This is a stylistic convention only; the preprocessor turns NULL back to 0 which is then recognized by the compiler (in pointer contexts) as before. In particular, a cast may still be necessary before NULL (as before 0) in a function call argument.
(The table under question 2 above applies for NULL as well as 0.)
NULL should _only_ be used for pointers.
II.18: What is the benefit of using const for declaring constants?
-
Answer:
The benefit of using the const keyword is that the compiler might be able
to make optimizations based on the knowledge that the value of the variabl...
No comments:
Post a Comment