> #define NUM_STU 15
> STRUCT table[50];
Why does your table have 50 entries when you only need 15?
By the way, your choice of typedef names is horrible, IMO.
STRUCT table[NUM_STU];
void printStruct(STRUCT table[])
{
STRUCT *pStuPtr;
for(pStuPtr = table; pStuPtr < table + NUM_STU; pStuPtr++)
{
printf("%s%s%d%f%f%f%f%f", pStuPtr->names, pStuPtr->lastNames, pStuPtr->id, pStuPtr->scores[0],
pStuPtr->scores[1], pStuPtr->scores[2], pStuPtr->scores[3], pStuPtr->scores[4]);
}
return;
}
Is there some particular reason you need to use a pointer here? A requirement for the assignment or something? There really is no need.
Code:
void printStruct(STRUCT table[])
{
int x;
for( x = 0; x < NUM_STU; x++ )
printf("%s %s %d %f %f %f %f %f",
table[x].names, table[x].lastNames, table[x].id,
table[x].scores[1], table[x].scores[2], table[x].scores[3],
table[x].scores[4], table[x].scores[5]
);
}
You can do the same thing for scanning. Either way will work. You just don't have to use a pointer there.
Quzah.