The same code ran in TURBO C.
struct details
{
char name[20];
int year;
float price;
}my_str;
details book1[10];
This error is produced. How can this be fixed?
ram.c: In function ‘main’:
ram.c:11:1: error: ‘details’ undeclared (first use in this function)
ram.c:11:1: note: each undeclared identifier is reported only once for each function it appears in
There are two ways to fix this:
Change second line to this:
Or you can change the declaration to:
C is slightly different from C++, so you can’t declare structs quite the same way.