I can not run a program that needs functions to execute a procedure, this function receives a vector of type struct through a pointer. It does not have a compilation error, but the program crashes when it runs and does not work. How do I use all of this together: pointer, vector, function, and struct. Thankful.
struct dataNasc{
int dia;
int mes;
int ano;
};
struct RgAluno{
char nome[35];
float nota[4];
float media;
struct dataNasc dn;
};
void ler(struct RgAluno* Aluno[]){
int i;
int j;
for(i=0;i<2;i++){
Aluno[i]->media=0;
}
for(i=0;i<2;i++){
printf("nome: ");
scanf("%s",&Aluno[i]->nome);
printf("data de nascimento:\ndia: ");
scanf("%d",&Aluno[i]->dn.dia);
printf("mes: ");
scanf("%d",&Aluno[i]->dn.mes);
printf("ano: ");
scanf("%d",&Aluno[i]->dn.ano);
for(j=0;j<4;j++){
printf("nota %d: ",j+1);
scanf("%f",&Aluno[i]->nota[j]);
Aluno[i]->media+=Aluno[i]->nota[j];
}
Aluno[i]->media/=4;
}
}
int main(){
struct RgAluno* Aluno[MAX];
ler(&Aluno);
return 0;
}