On today's flat memory machines, NULL is defined as some form of 0. On segmented systems, where pointers are multicomponent, NULL can be anything, but usually some form of 0:0. (elder borland compilers defined it differently) The general rule for c is that 0 is a literal zero and NULL is a memory offset that will never be returned by malloc() or any similar call, so it can be used for marking a pointer as invalid or empty. For cpp it's more clearly defined but until the standard offers something more defined for null pointers, imho the best practice is to use NULL. The writer of the system dependent header file that contains its definition probably knows better what value should it have.
Viktor
What should I use NULL or 0
Quote:Original post by KingsRevenge
However what happens when you type a variable name over 256 letters?
I never tried it.. I just read the number 256 somewhere. I imagine that should you type such a long name, the dev environment would throw an error. Considering the code is compiles, symbol names don't matter, but for the compiling itself there are limits everywhere (such as the 1024-include-depth limit).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement