c - What happens when you calloc a struct containing an enum type? -
typedef enum { false, true }bool; struct { bool value_set; int value; }
what happens when struct allocated using calloc? enum hold false default value? since calloc sets memory 0.
an enum integral type. if don't assign them values, start @ 0 , increase. therefore typedef equivalent
typedef enum { false = 0; true = 1; } bool;
therefore calloc set value_set
0 equal false
.
Comments
Post a Comment