I am fairly new to the concept of structs in C, and have run into a problem. I have looked for any similar problems posted here, but cannot find any. What I am trying to do is pass a variable in an array of structs as a parameter in a function, as so:
struct Student
{
float average;
int ID;
int grades[5];
char firstName[20], lastName[20];
};
void main(void)
{
struct Student sTable[10];
float maxAverage(float sTable[].average)
{
int i;
float max = 0;
for(i = 0;i < 10; ++i)
{
if(sTable[i].value > max)
{
max += sTable[i].value;
}
}
return max;
}
printf("%f",maxAverage(sTable[].average));
}