My function is returning the following error when executing the program: Process returned -1073741819 (0xC0000005).
Until the moment I assign the inputs to the variables, it works. However, when the program is going to assign the values of the variables to the pointers, the program stops.
void Cadastrar(pessoas *p){
    char nome[50];
    int idade;
    char sexo;
    char endereco [200];
    printf("Digite o nome: ");
    fflush(stdin);
    scanf("%s",nome);
    fflush(stdin);
    printf("Digite a idade: ");
    scanf("%d",&idade);
    printf("Escolha o sexo: ");
    fflush(stdin);
    sexo = getchar();
    fflush(stdin);
    printf("Digite o endereco: ");
    fflush(stdin);
    scanf("%s",endereco);
    fflush(stdin);
    strncpy(p->nome,nome, sizeof(nome));
    p->idade = idade;
    p->sexo = sexo;
    strncpy(p->endereco,endereco, sizeof(nome));
}
 
    