Το παρακάτω παράδειγμα αναζητά έναν ακέραιο σε μια συνδεδεμένη λίστα
ακεραίων και επιστρέφει δείκτη στη δομή που τον περιέχει ή NULL αν η
λίστα δεν περιέχει τον ακέραιο αυτό:
#include <stdlib.h>
struct s_ilist {
int i;
struct s_ilist *next;
};
/*
* Search for the integer i in the linked list p.
* Return a pointer to the first element containing the integer
* if found; NULL if the integer is not in the list.
*/
struct s_ilist *
isearch(struct s_ilist *p, int i)
{
for (; p != NULL; p = p->next)
if (p->i == i)
return (p);
return (NULL);
}