Within the function reverseList:
node *reverseList(node *h) { node *p, *q, *r; p = h->next; q = h; r = NULL; while (p) { r = q; q = p; p = p->next; q->next = r; } h = q; return h; }
Within the function reverseList:
node *reverseList(node *h) { node *p, *q, *r; p = h->next; q = h; r = NULL; while (p) { r = q; q = p; p = p->next; q->next = r; } h = q; return h; }