Write a program to reverse a linked list?

Answer Posted / bipin pandey

node *reverse(node *first)


{
node *cur,*temp;


cur=NULL;

while(first!=NULL)


{temp=first;

first=first->link;

temp->link=cur;

cur=temp;
}

return cur;

}

Is This Answer Correct ?    5 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are advantages of c++?

766


What are member functions used in c++?

761


What c++ is used for?

812


Why is c++ still used?

782


Write a function to find the nth item from the end of a linked list in a single pass.

730


What are features of c++?

819


Explain Memory Allocation in C/C++ ?

808


What is class invariant in c++?

937


What do you mean by function overriding & function overloading in c++?

788


What is the best ide for c++?

781


What is heap sort in c++?

830


Should a constructor be public or private?

730


How do I use arrays in c++?

753


What do you understand by a pure virtual member function?

756


Can a program run without main function?

860