Following code
#include <stdio.h> int main( int argc, char** argv ) { const char *s = ""; if (s == '\0') { int x = 0; } return 0; } It does not go in the loop. Why ? ,
You've defined s as a pointer to char. As it happens, '\0' is an integer constant expression with the value 0 -- the definition of a null pointer constant.
IOW, you're doing the equivalent of if (s == NULL). Since s actually points at a string literal, it's not a null pointer, so the comparison is false.
I'd guess what you intended is if (*s == '\0') ..., which should compare as true.
""is just one null character.