I am studying physics and in the lecture notes of our programming course it is written that a character constant, in C has type char, where by character con
You may find this code elucidating:
#include
int main() {
printf("size of char is %ld\n", sizeof(char));
printf("size of const char is %ld\n", sizeof(const char));
printf("size of int is %ld\n", sizeof(int));
printf("size of 'x' is %ld\n", sizeof('x'));
}
Please compile on your system. On my system (OS X, compiling with either gcc -m32 or gcc -m64), the output is:
size of char is 1
size of const char is 1
size of int is 4
size of 'x' is 4
I hope this helps.