Click to See Complete Forum and Search --> : Structure Arrays


Charred_Phoenix
08-01-2003, 05:54 AM
If I have this:
struct homework {
char subject[20];
char task[1000];
char due[8];
}

and want 15 sets of this, how can I do the working equivalent of struct homework[15]?

ljfong
08-01-2003, 07:12 AM
If I understand what you want correctly :


/* redefine struct homework type as homework */
typedef struct homework homework;
int main(void)
{
/* declare an array named hw which contains */
/* fifteen structures of type homework */
homework hw[15];
}

Charred_Phoenix
08-01-2003, 07:22 PM
Oh, thanks. *reads up on typdedefs* :D