consider the following:
typedef struct
{
char name[20];
int memory;
int time;
int files;
} proceso; // proceso is a "type" of struct
// defined as having the above elements
proceso titulos[MAX_TITLES] = { // titulos is an instance of proceso
{"Doom3", 500, 4,5}, // declared as an array
{"Hades", 100, 2,1}, // and containing the following values
{"Word" , 50, 1,1},
{"FIFA" , 10, 3,1},
{"Doom2", 400, 5,2},
// ...
// question: how many is "MAX_TITLES" ?
};
//....
// print fields like so
for (i=0; i<MAX_TITLES; i++)
{
printf("title name: %s (%d MB)\n",titulos[i].name, titulos[i].memory);
}
// etc...
Reputation Points: 2143
Solved Threads: 178
Posting Maven
Offline 2,567 posts
since Feb 2008