I'm working on an exercise in c the last few days and I'm having this warning (as the title suggests). I've tried a bunch of stuff but I don't really know how to exactly fix this. I'm not good at programming so there are mistakes. Below are the structs I'm using (which cannot be changed because that's how they are given):
typedef struct bookR* book; struct bookR{ char author[MAXSTRING]; enum genres{fiction,scientific,politics}; int id; char review[MAXLINES][MAXSTRING]; }; typedef struct nodeR* node; struct nodeR{ book b; node next; }; typedef struct listR* list; struct listR{ node head, tail; int size; };
And here is part of the code where the problem occurs:
void addBook(book b, list bList){ char author [MAXSTRING]; int id; char review [MAXSTRING][MAXLINES]; printf ("Give the author,`enter code here` id and review of the new book respectively"); scanf("%s",author); scanf("%d",&id); scanf("%s",review); node k=(node)malloc(sizeof(struct nodeR)); assert(k); k->next=NULL; strcpy(k->b->author,author); k->b->id=id; strcpy(k->b->review,review[MAXSTRING]);}
And this is the warning I'm getting:
warning: format '%s' expects argument of type 'char *' but argument 2 has type 'char (*)[100]' [-Wformat=] scanf("%s",review); warining:passing argument 1 of 'strcpy' from incompatible pointer tupe [-Wincompatible-pointer-types] strcpy(k->b->review,review[MAXSTRING]);
Any help is much appreciated. Thanks for your time and sorry for the long post.