Why does “sizeof(a ? true : false)” give an output of four bytes?

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)