It’s because you have #include <stdbool.h>
. That header defines macros true
and false
to be 1
and 0
, so your statement looks like this:
printf("%zu\n", sizeof(a ? 1 : 0)); // Why 4?
sizeof(int)
is 4 on your platform.
It’s because you have #include <stdbool.h>
. That header defines macros true
and false
to be 1
and 0
, so your statement looks like this:
printf("%zu\n", sizeof(a ? 1 : 0)); // Why 4?
sizeof(int)
is 4 on your platform.