Where you have 1 or more first and last names and the year in which the book was written.
What kind of structure do you think is better?
Me and my partner were thinking of an array of structs where the structs had the name of one author and then a pointer to an array which had who said writer worked with and when.
I would actually use two different structs and an array of structs:
struct Author {
char *firstName;
char *lastName;
} ;
struct Book {
unsigned short year;
struct Author *authors;
};
Don't forget to allocate memory for both structs for each book
Here's an example for one book
struct Book book = malloc(sizeof(*book) * sizeof(*book->authors));
And you will have to allocation memory for the first and last names of each author's first and last names and store them in each struct as you read them in.
you need to store the array size, you don't cast allocations, malloc returns a pointer, your book allocation doesn't make sense if authors is an array because that would always give you a one element array.
I was giving an example for one book and one author.
I am not going to give the code for dynamically allocating and re-allocating both the author array and book array when encountering different sizes of each.
That would be the bulk of their assignment and I am sure they want to do that on their own.