reverse a ll

 node* reverse(node* head){

    node* previous=NULL;

    node* current=head;

    node* n;

    

    while(current!=NULL){

        node* n=current->next;

        current->next=previous;

        //n->next=current;

        previous = current;

        current = n;

        

        

    }

    head=previous;

    return head;

}

Comments

Popular posts from this blog

Sum of Even Numbers till N

Find the Runner-Up Score!

Print All Substrings