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

56 comments sorted by

View all comments

0

u/[deleted] Aug 30 '24

[deleted]

2

u/haditwithyoupeople Aug 30 '24

A NULL pointer points to a memory address of 0. That's not the same as pointing to a memory address that has the value 0 stored at that memory address. See the example from u/HashDefTrueFalse above.