mardi 23 mars 2021

If statement ignored in search function?

I made a search function that finds a name in a node of a LL, and returns info in that node (a string). But for some reason the if statement is completely ignored. Here is the code:

const char* search_ability(op* head, char naem[50]){

op* walker=head;

while (walker!=NULL)

{
    if (strcmp(naem,walker->name)==0)
      return walker->ability;
      walker=walker->next;


}

return "NF";
}

Aucun commentaire:

Enregistrer un commentaire