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

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -