String termination – char c=0 vs char c=’\0′

Binary   Oct  Dec    Hex    Abbr    Unicode  Control char  C Escape code   Name
0000000  000  0      00     NUL     ␀       ^@            \0              Null character

There’s no difference, but the more idiomatic one is '\0'.

Putting it down as char c = 0; could mean that you intend to use it as a number (e.g. a counter). '\0' is unambiguous.

Leave a Comment