I get the following error when wanting to pass the vector to a function:
[Error] could not convert '(teachers *) (& prfsr)' from 'professors *' to 'professors'.
I pass the code to see what's wrong, I've been trying for a while to solve it, even pass it with pointers and even then it keeps giving me an error, thanks in advance for the help.
#include<stdio.h>
#include<stdlib.h>
struct profesores{
char nombre[30];
char sexo[30];
int edad;
};
void promed(profesores,int);
void joven(profesores, int);
int menu();
int main(){
profesores prfsr[100];
int n,opcion;
float promedio;
printf("-------BIENVENIDO AL REGISTRO DE LOS PROFESORES-------\n");
printf("Cuantos profesores desea registrar?\n");
scanf("%d",&n);
for(int i=0;i<n;i++){
printf("Introduzca el nombre\n");
fflush(stdin);
gets(prfsr[i].nombre);
printf("Introduzca el genero\n");
fflush(stdin);
gets(prfsr[i].sexo);
printf("Introduzca la edad\n");
scanf("%d",&prfsr[i].edad);
system("cls");
if(i==n-1){
printf("Profesores Registrados Exitosamente\n");
}
}
promed(prfsr,n);
opcion=menu();
switch(opcion){
case 1:
break;
}
}
int menu(){
int opcion;
printf("Seleccione una opcion\n");
printf("1....Nombre del profesor mas joven del registro\n");
printf("2....Nombre del profesor con mas edad\n");
printf("3....No. de Profesores con edad mayor al promedio\n");
printf("4....No. de Profesores con edad menor al promedio\n");
scanf("%d",&opcion);
return opcion;
}
void joven(profesores registro[],int n){
for(int i=0;i<n;i++){
registro[i].edad;
}
}
void promed(profesores promedio[],int n){
float prom=0;
int suma;
for(int i=0;i<n;i++){
suma=suma+promedio[i].edad;
}
prom= suma/n;
}