Hey guys,
This is what I want to do..I want to traverse my linked list (thats why I use pWalker) and check and see if the user inputted last name matches that of contacts in the linked list (thats why I use strcmp)..
if it does, I print that node
if it does not exist, I print the error msg..
now..how do I get it to work so that if it does find it, it does not print the contact details (or the error msg for that matter) over and over and over again??
Any ideas, corrections?
Thanks
A

Code:
fflush(stdin);
printf("Please enter last name: ");
scanf("%s", lastName);
fflush(stdin);
pWalker = pList;
while(pWalker)
 {
 if(strcmp(lastName, pWalker->directory.k.lName) == 0)
{
 printNode(pWalker);
}
else
{
 errorMsg();
}
}
pWalker = pWalker->next;
break;