If I were to have two structs
typedef struct {
int number_of_lines;
char lines[MAX_CHAPTER_LINES][MAX_STR_SIZE + 1];
} Chapter;
typedef struct {
char name[MAX_STR_SIZE + 1];
int number_of_chapters;
Chapter chapters[MAX_CHAPTERS];
} Book;
And I created a Chapter variable:
Chapter x1;
What would the values of its two members be initialized to? Is it garbage? Or is it zero? In my code I got 0 for the int, but my TA told me it would be garbage?
Also, if I were to declare an array of chapters:
Chapter chapters[30];
Would it be filled with 30 structs with 0/NULL valued elements? Or initialized with garbage valued elements?