Wednesday, August 19, 2009

Difference between NULL and NUL

Difference Between NUL and NULL in C Language :

Hi Everyone.....

i seems no matter how much C language you learn it seems it will never end....
i found a very interesting difference between NUL and NULL in C language while going through a book which i would like to share:

NULL is an pointer with value zero (0) , that is you can say it does not correspond to a real memory location in your program. For linux operating system it is defined as ((void *)(0)) .

Whereas NUL is an character with integer value 0 (zero) . It is this NUL character you keep hearing about which comes at the end of every string as "\0" or "(char)(0)" and takes a memory space equal to that of a character .

so to remember NULL is a pointer and NUL is a character :)

1 comment:

  1. but isn't the memory addressing handled by the operating system. how can the pointer point to 00 defined by user???

    ReplyDelete

About Me

My photo
Hi Friends, I am Samarth currently pursuing my Masters degree in Information Technology from International Institute of Information Technology ,Bangalore .