Clarification: null and zero


#1

Just to clarify, there is a difference between zero and a null byte. Page 249, has a comment line that says,

// Put a zero in the fifth byte *(start + 4) = '\0';

Whilst the code assigns the null byte as required to terminate the string, this is not the same as a value of zero.


#2

Character code ‘\0’ is the same as the value 0, and a null byte contains the value 0.

// Put a zero in the fifth byte (to terminate the string; the string has to be at least five bytes long.)
*(start + 4) = 0;

#3

in C :
NULL == ‘\0’ == 0

It’s a good practice to use :
NULL for pointer (char*s = NULL)
’\0’ for character (*s=’\0’)
and 0 for integer (int i =0)