I created a code for a college exercise that was running right, but I forgot that one of the variables of struct
was a vector, and when I made a simple change everything changed. Virtually all functions are giving error. I do not find the answer anywhere.
BEFORE (when it worked) looked like this:
struct turma{
int matricula;
char nome[15];
float nota;
float media;
char resultado;
}; typedef struct turma turma;
Then I changed to:
struct turma{
int matricula;
char nome[15];
float nota[5];
float media;
char resultado;
}; typedef struct turma turma;
And nothing else works. Here is the example of a function that started to give error:
void insere (turma alg[MAX])
{ int x,y;
float cont=0;
for (x=0;x<MAX;x++)
{ printf("\nInforme os dados do %iº aluno: ", x+1);
printf("\n\nMatrícula: ", x+1);
scanf("%d", &alg[x].matricula);
printf("Nome: ", x+1);
fflush(stdin);
scanf("%s", &alg[x].nome);
for (y=0;y<5;y++){
printf("%iº nota: ", y+1);
scanf("%f", &alg[y].nota);
cont = cont + alg[y].nota;
}
}
}
The error of the last line is an error:
invalid operands to binary + (have 'float' and 'float *')