The following code works fine when head is sent as a parameter to it. As I am new to C, I couldn\'t understand how it works. Help me out please.
struct node
ll *rev_list(ll *prev, ll *cur) { if (!cur) { return prev; } ll *tmp = cur; cur = cur->next; tmp->next = prev; prev = tmp; return rev_list(prev, cur); }
Find complete code : https://github.com/vijaythreadtemp/Data-Structures-And-Algorithms/blob/master/rev_link_list_rec.cxx