I am having an issue with one/two of my methods when I am calling it in main()
and I\'m unsure why.
int main()
{
struct list * list;
lis
Issue:1:
Change the return type of list_init
struct list* list_init()
{
list = malloc(sizeof(*list));
if(list != NULL)
{
list->head = NULL;
list->num_books = 0;
}
return list;
}
And call it this way in main()
int main() {
struct list * list;
list = list_init();
Issue:2:
After this another issue is that in while loop every time you are taking local copy of book and using that pointer in list_add()
struct book book1;
I suggest to malloc every time, SO for every entry you will have seperate copy of book