The question is as follows (keep in mind that I am just learning C):
Suppose I define a structure similar to this one
struct Alumnos{
char asignatura[25];
int nota;
};
and I want the user to enter a last name, save it in a variable of type char
and send it to a function that the only thing it does is create a .. (I do not know what would be called a structure of students?) I referred a:
struct Alumnos -Aca la variable char con el apellido-;
Suppose .. the surname "ramirez", stored in variable char
:
char apellido[]="ramirez";
struct Alumnos apellido;
and then enter the subject data and note like this:
apellido.nota=4;
Is this possible, and if so, how is it done? (I'm just showing you my idea but it obviously does not work), I was rummaging through other forums and found something like this:
int cont=0;
struct agenda {
char nom[15];
int t_f;
int t_m;
char dir[30], email[40], grupos[12];
} control[100];
and then within the "add contact" function, what was done was
fflush(stdin);
printf("\n%d.Nombre de contacto:", (cont+1));
gets(control[cont].nom);
but it does not convince me and I do not understand it at all, I also want to access the data of that structure with the last name, so if someone wants to consult it you can do it by entering the last name ... in the end, that is my question, I am grateful Help me. Greetings.