ASCII value = 0 and '\0'
问题 I have read this post. But when I tried: printf("before null %c after null\n", 0); // (ASCII=0) != '\0' ?? instead of getting: before null I got: before null after null So my question is: Is ASCII value 0 actually equal to '\0'? 回答1: Is ASCII value 0 actually equal to \0 ? Yes The differences in how the strings are stored in memory and handled by functions like printf() are important. "before null %c after null\n" "before null \0 after null\n" Both are stored in memory with an implicit \0