Created
July 21, 2015 13:55
-
-
Save raju249/e982c977ef7029cfef7d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Searches for a number in list. | |
*/ | |
void search(void) | |
{ | |
// prompt user for number | |
printf("Number to search for: "); | |
int n = GetInt(); | |
// get list's first node | |
node* ptr = first; | |
// search for number | |
while (ptr != NULL) | |
{ | |
if (ptr->n == n) | |
{ | |
printf("\nFound %i!\n", n); | |
sleep(1); | |
break; | |
} | |
ptr = ptr->next; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment