ASCII NUL, ASCII 0 (‘0’) and Numeric literal 0?

CServer Side ProgrammingProgramming

Here we will see the ASCII NUL, ASCII 0 and the Numeric Literal 0. The ASCII null is represented as 0x00, and zero is represented as 0x30. The ASCII NUL character is used to denote the end of the string in C or C++. When programmer used ‘0’ (character 0) it is treated as 0x30. This is a hexadecimal number. The decimal equivalent is 48. To put ASCII NUL we have to mention ‘\0’ instead of ‘0’.

char asciiNul = ‘\0’;
int zero = 0;
char zeroChar = ‘0’;

The first one is ASCII NUL, second one is numeric 0, and the third one is character 0.

Updated on 30-Jul-2019 22:30:26