This is the problem of strings chapter from Let Us C book ?
printf("Size of char = %d\n", sizeof(char));
printf("\n%d %d %d", sizeof('3'), sizeof("3"), sizeof(3));
I get this output:
Size of char = 1
4 2 4
I can't understand why the compiler is showing 4 2 4 output while the size of char is 1 in 64-bit C-compiler so according to my logic it should be 1 2 4. Can anyone have a look?
charby definition is of size 1.'3'is an integer character constant which is of typeint.sizeof(int) == 4on your system."3"({'3', '\0'}) is achar [2]. Eachcharis1.3is also anint.