When I run the program and give values to the id, name, surname it gives them all the value of the last student. For instance if the last students name is Anna then all the othe
You should reserve memory for the string attributes. As a hint, use a struct similar to:
#define MAX_LEN 32
struct Student{ /*struct for student info*/
char id[MAX_LEN];
char name[MAX_LEN];
char surname[MAX_LEN];
int grade;
};
Define MAX_LEN
to something that is reasonable for you, and check that the entered values aren't any longer. Also make sure to strcpy
the input values to the struct variables.