What is the output of the following C program?
#include <stdio.h>
int main(void) {
printf("%zu %zu\n", sizeof 'A', sizeof ((char) 'A'));
return 0;
}
In C a character constant such as 'A' has type int, so its size is 4. Cast to char, it is 1. (In C++, 'A' is a char and its size is 1 – a favourite interview trap.)