-1
Guys, I’m trying to make a struct that receives information from the user and then it displays the information. But you are showing this error when I compile '[Error] request for Member in Something not a Structure or Union".
Follows the Code...
#include <stdio.h>
#include <stdlib.h>
struct funcionario
{
char nome[40];
char cargo[40];
int cpf[11];
};
cad_func[2];
int main(void) {
int i;
printf("INSIRA SEUS DADOS.\n\n\n");
for(i=0; i<2; i++)
{
printf("nome: ");
fflush(stdin);
gets(cad_func[i].nome);
printf("cargo: ");
fflush(stdin);
gets(cad_func[i].cargo);
printf("cpf: ");
scanf("%d", &cad_func[i].cpf);
}
printf("Dados dos funcionarios:\n\n");
for(i=0; i<2; i++){
printf("Nome: %s", cad_func[i].nome);
printf("Cargo: %s", cad_func[i].cargo);
printf("Nome: %d", cad_func[i].cpf);
}
return 0;
}
Thank you!!!