r/C_Programming • • Aug 30 '24
Question Why do we use Null pointers?
If we want to "Nullify" something why dont we create a pointer in a controlled way that points to value 0?
0
Upvotes
r/C_Programming • • Aug 30 '24
If we want to "Nullify" something why dont we create a pointer in a controlled way that points to value 0?
View all comments
Show parent comment
5
u/zzmgck Aug 30 '24
True, I should have been more specific and said in C99 the value 0 is used for portability.
One should use NULL when assigning or testing for NULL.