Page 154, Exercise 2
Call:
if (search(ptr,key))
printf("The key is in the list\n");
else
printf("The key is not in the list\n"); |
list_pointer search(list_pointer ptr, int key)
{/* determine if key is in the list */
list_pointer temp;
for (temp = ptr; temp; temp = temp->link)
if (temp->item.key == key) return temp;
return NULL;
}
|