struct list { long x; struct list * next; }; long length(struct list * l) { long n = 0; while(l) { n++; l = l->next; } return n; }