3
I’m trying to use the function gets
(language C), but it doesn’t work. Am I using it wrong? The code is like this:
#include <stdio.h>
typedef struct {
int matricula;
char nome[40];
int nota_1;
int nota_2;
int nota_3;
}aluno;
int main (){
aluno a[5];
int i;
for (i=0; i<5; i++){
printf("Matricula\n");
scanf("%d", &a[i].matricula);
printf("Nome\n");
gets(a[i].nome);
printf("Nota das provas\n");
scanf("%d %d %d", &a[i].nota_1, &a[i].nota_2, &a[i].nota_3);
}
}
Always inform in your question what the problem is occurring.
– Maniero