Advertisement
typedef struct{
unsigned int age : 4;
unsigned char gender : 1;
char : 0;
unsigned int size : 2;
}child_t;
- Yes, it causes a compiler error because the colon character is not allowed in struct definitions.
- and child_t is a type defined as a structure with bit fields. It has 4 bits for age and 1 bit for gender in the first byte, and 2 bits for size in the second byte.
- Yes, it causes a compiler error because there is an unnamed field.
- Yes, it causes a compiler error because one field is defined as having a size of 0.
Join our list
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.