newUpdate: seems to work now
updated:
OK, so this is my declared 2d array:
int data[10][20];
It's filled up with variables as such:
k=0;
token = strtok (str," ");
while (token != NULL)
{
sscanf (token, "%d", &var);
data[k++][i] = var;
token = strtok (NULL," ");
}
So we expect data[0-9][i]
for each i. Then we find the index we need to use
data[0-9][j]
case 2:
prinf("What experiment would you like to use?\n");
token = strtok (NULL," ");
sscanf (token, "%s", &str2);
for(j=0;j<i;j++)
{
if(strcmp(experiments[j],str))
{
indAvg = individualAverage(data,j);
printf("The individual average of %s is %d\n",experiments[j],indAvg);
break;
}
}
Which is meant to call this:
int individualAverage(int data[][20],int j)
{
int k,average=0;
for(k=0;k<10;k++)
{
average += data[k][j];
}
return average;
}
The problem I'm getting is that it says in my individualAverage
function, the 'array type has incomplete element type'.
In my call to the function, it says 'type of formal parameter 1 is incomplete'.
I'm not sure what I'm doing wrong here?
Thanks.