Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Comments on What's the difference between null pointers and NULL?
Parent
What's the difference between null pointers and NULL?
Someone told me that I shouldn't write "NULL pointer" with capital letters, because a null pointer and NULL are different terms. And that NULL is a "null pointer constant". What's the meaning of this?
Does this have anything to do with some systems allowing a different representation of the null pointer other than zero? Can NULL be something other than zero?
Post
In short, NULL is the 0 value, and a null pointer is a pointer variable that points to nothing.
some systems allowing a different representation of the null pointer other than zero
Years back compilers implemented some things on their own, partly because the language standards weren't strictly defined and imposed. For instance, I remember using a compiler that handled random
related implementations in a different manner than other compilers. So, while some compilers defined their own null pointer implementation, NULL was always 0.
Can NULL be something other than zero?
No, I don't think so. However, you can tweak a compiler to replace instances of NULL with a value other than 0, but that wouldn't be a standard C compiler then.
0 comment threads