The ASCII character '0' is different from the number 0 . You print the integer 0 in the second pair of printf instead of '0' .
Try the following:
printf("'\\0' : %d\n", '\0'); printf("'\\0' in hex : %x\n", '\0'); printf("'0' : %d\n", '0'); printf("'0' in hex: %x\n", '0');
Also, you do not need to hide ' inside strings. That is, "'" excellent, and you do not need to write "\'"
source share