I have a small piece of code about the sizeof
operator with the ternary operator:
#include
#include
int main()
{
Here is a snippet from which is what included in the source
#ifndef __cplusplus
#define bool _Bool
#define true 1
#define false 0
#else /* __cplusplus */
There macros true
and false
are declared as 1 and 0 respectively.
however in this case the type is the type of the literal constants. Both 0 and 1 are integer constants that fit in an int, so their type is int.
and the sizeof(int)
in your case is 4.