How do you do it?
plz and thank you.
Printable View
How do you do it?
plz and thank you.
anyone??????? i didn't realise that the question was that hard.
You can nest structs, no problem:
//etc.Code:struct NAME {
char fname[20];
char lname[20];
}
struct student {
struct NAME;
int ID;
char major[30];
char advisor[30];
float GPA;
}students[50];
Access is via the dot operator:
for(i = 0; i < 50; i++)
printf("%s", students[i].NAME.fname);
In real code, you'd want just the definition of the structs global, and the declarations of the students array to be done in main(), probably.
thank you.
You're quite welcome, J.
> anyone??????? i didn't realise that the question was that hard.
You only waited 15 minutes before deciding it was too hard.
... and at midnight.