problem with sizeof()

Why am i getting the output of the followiing code as
1
even if there is no character between the double quotes???
1
2
3
4
5
6
#include <stdio.h>
int main()
{
    printf("%d",sizeof(""));
    getchar();
}
Last edited on
Why? Because string literals are still null-terminated, just like strings and character arrays. That still takes up a character which is equal to one byte.
Last edited on
Topic archived. No new replies allowed.