This is just a function in my program. I am getting error in this function.
I know it is something to do with the structs.
The error points to 'struct BOOK book;'
I am trying to print all books for user to see.
Library_Management.c: In function ‘viewbooks’:
Library_Management.c:217:14: error: storage size of ‘book’ isn’t known
Please HELP
void viewbooks() //show the list of book persists in library
struct BOOK;
{
int id[10];
char name[20];
char Author[20];
int quantity;
float Price;
int rackno;
char *cat;
}
FILE *fp;
struct BOOK book;
system("clear");
printf("*********************************Book List*****************************");
printf(" CATEGORY ID BOOK NAME AUTHOR QTY PRICE RackNo ");
fp=fopen("record.txt","r");
while(1){
fread(&book,sizeof(book),1,fp);
if(feof(fp))
{
break;
}
printf("%s",book.cat);
printf("%d",book.id);
printf("%s",book.name);
printf("%s",book.Author);
printf("%d",book.quantity);
printf("%.2f",book.Price);
printf("%d",book.rackno);
printf("\n\n");
}
fclose(fp);
//returnfunc();*/
}