1/*
2 * Copyright 2014, NICTA
3 *
4 * This software may be distributed and modified according to the terms of
5 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
6 * See "LICENSE_BSD2.txt" for details.
7 *
8 * @TAG(NICTA_BSD)
9 */
10
11struct list {
12  int contents;
13  struct list *next;
14};
15
16int last(struct list *nodeptr)
17{
18  if (!nodeptr) { return 0; }
19  while (!nodeptr->next) {
20    nodeptr = nodeptr->next;
21  }
22  return nodeptr->contents;
23}
24