I just started working with structs and I ran into this problem where it gives me the following error that I don't know how to tackle:
Flexible array member 'name' with type 'char []' is not at the end of struct
I found out that making the chars as pointers or giving them a size fixes the error but I'm not sure I'm doing the right thing.
struct car{
char company[];
char model[];
int price;
int hp;
char fuel_type[];
char color[];
};
The above doesn't work but this does:
struct car{
char company[20];
char model[20];
int price;
int hp;
char fuel_type[20];
char color[20];
};
Same thing with pointers. So, what and how should I use to fix this?