Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Elem *searchlist(struct Elem* list, int k)
- {
- while (list != NULL)
- {
- if (list->tag == INTEGER)
- {
- if (list->value.i == k)
- return list;
- }
- else if (list->tag == LIST)
- {
- struct Elem* result = searchlist(list->value.list, k);
- if (result != NULL)
- return result;
- }
- list = list->tail;
- }
- return list;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement