I want to search an element of a list by a name (vector of characters). I get the name (espm) in function and childbirth for the search.
The problem is that the function always tells me "There is no doctor with this specialty" even when the name (espm) exists in my lita ( aux->esp==espm
).
Note: I have already tried to search for a number ( int
or float
) with this same function and worked. But when I try to search with a string
it goes wrong. WHY ???
void pesquisa_med(char* espm){
MEDICO *aux;
int flag=0;
aux = primeirom->mprox;
while(aux!=NULL){
if(aux->esp == espm){
printf("%s %s", aux->mnome, aux->mapelido);
flag=1;
aux=NULL;
}
else
aux=aux->mprox;
}
if(!flag)
printf("Nao existe medico com essa especialidade.");
}