2
I am trying to search a struct vector to return a list from the sex variable, but at string comparison time the list is not returned.
complete code: PASTEBIN
    void consultar_registro()
    {
    struct pessoas p[5];
    int op2,i;
    char s[30];
    printf("\nEscolha como deseja buscar no registro: ");
    printf("\n1-Sexo\n2-Idade\n");
    scanf("%d",&op2);
    switch(op2)
    {
    case 1:
  //ERRO  
    printf("\nDigite o sexo que deseja buscar: ");
    scanf("%s",&s);
    for(i=0;i<5;i++)
    {
    if(strcmp(s,p[i].sexo)==0)
    {
    printf("\nNome: %s",p[i].nome);
    printf("\nSexo: %s",p[i].sexo);
    printf("\nIdade: %s",p[i].idade);
    }
    else
    {
     printf("\nNao foi encontrado\n");
    }
    }
    //ERRO
    break;
    case 2:
    printf("");
    break;
    default:
    printf("\nOpcao invalida");
    break;
    }
						
Thanks man because I did not know this detail of the global variable
– FZero