Flexible Array Members in a structure in C
Flexible Array Members in a structure in C, is not took into account for the size of the struct. For example, as the following code shows:
struct student {
int stud_id;
int name_len;
int struct_size;
char stud_name[];
};
struct teacher {
char teacher_name[];
};
// The sizeof(struct student) is 4 + 4 + 4 + 0 = 12
// There will be a compile error for the teacher
// struct, which is
// "flexible array member in a struct with no named members"