Why does printf
print a space instead of stopping when I use the NULL character from the ASCII table? This is what I mean:
printf("Hello%c, world", 0); //Hello , world
printf("Hello%c, world", '\0'); //Hello , world
Only when I put the escape character in the string itself printf
stops the string:
printf("Hello\0, world"); //Hello
I tried this on Windows 8, Windows 10 (using cygwin, MinGW, Netbeans, Code::Blocks), XUbuntu, it's all the same.
Where is the problem? I asked one of my friends, but he said that he has no such problem, that all three examples executed the same way.