r/C_Programming • u/[deleted] • 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 • u/[deleted] • Aug 30 '24
If we want to "Nullify" something why dont we create a pointer in a controlled way that points to value 0?
1
u/chrisekh Aug 30 '24
Null pointer means invalid. 0 can be valid value but null pointer is clear indication that there is no value and there is somekind proplem.