I've read and looked at some example of flexible array members but I am not exactly sure how to add and read elements of this variable length array.
typedef struct School {
char *name;
char *courses[]; //Flexible Array Member
} School;
1) Can someone please show me an example of how I can add an element to this Flexible Length Member and print it after it is stored.
2) I also would like to know how to malloc it correctly. Based on what I have read about Flexible Array Members, we would need to add more space for the flexible array member and can't just use sizeof(School);
. My only issue is how do I know how much do add for that flexible member.