Please could someone look at the following code and see if with some
modifications it is possible to make it work:
I just want to allocate some memory at runtime for 500 structures (in
this example) and use it as in the example
Thank you
Carlos
struct data {
char name[10];
long age;
} ENTRY;
struct ENTRY * list1 = (struct ENTRY *)malloc(500 * sizeof(ENTRY));
strcpy(list1[1].name, "Hello"); (1)
list1[1].age = 5;
(1) will give the following errors:
unknown size for type 'incomplete struct ENTRY defined at....
unknown field 'name' of 'incomplete struct ENTRY defined at...
type error in argument 1 to 'strcpy'; found 'int' expected 'pointer to
char'