I need to search for a surname in an ordered list, when the user inputs the surname. I have tried using this code but it fails to work although it worked when I searched for files greater than or less than a certain number. I have used a switch statement depending on what the user inputs he can view a certain record etc, surname, address.....
please can you help me?
Will...
case 1 : printf ("\nPlease enter a surname: ");
scanf ("%s", &surtype);
while (element != NULL)
{
if (element->surname == surtype)
{
printf ("%s", element->surname,
}
else if (element->surname != surtype)
{
printf ("Sorry there is no records matching that surname\n");
}
element = element->next;
}