Function to reverse a linked list
No Comments
struct node *reverse(struct node *start) { struct node *previous, *ptr, *next; previous = NULL; ptr = start; while(ptr!=NULL) { next=ptr->link; ptr->link=previous; previous=ptr; ptr=next; } start=previous; return start; }
Read More