I am developing a program that has to manage a canteen of a school and on the menu I have an option to search for student by number and another to search for all students who have the first name in common. Here is my code, where I can not see my problem:
void FindStudentsByName(FILE *f) {
//FILE *file;
//const char *filename = "database-aluno.txt";
//file = fopen(filename,"r");
struct Aluno student;
char name[50];
printf("Insira Nome (Primeiro nome) ");
scanf("%s", name);
while (!(feof(f)))
{
fscanf(f, "%s %s %s %lf %d-%d\n", &student.num, student.name,
student.fname,&student.saldo, &student.dia, &student.mes);
if (name == student.name)
{
fprintf(f,"Numero: %d \n", student.num);
fprintf(f,"Nome: %s\n ", student.fname);
}
}
}
I'm almost sure that the error is small, but I could not resolve it. The output I want is if for example there are 20 students with the name vitor the program show me the numbers of the 20 students and their names.