This will works Recusivly and easily
Reversing Singly Linked List Easily
void rev(node *h,node *myparentaddr)
{
if(h->next!=NULL)
{
rev(h->next,h);
tail=h;
}
else
head=h;
h->next=myparentaddr;
}
call it in main by rev(head,NULL);
jai_steave 0 Newbie Poster
Duoas 1,025 Postaholic Featured Poster
farwa 0 Newbie Poster
jessel 0 Newbie Poster
biswarup.nandi.71 0 Newbie Poster
rustysynate 0 Newbie Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.