Write a program to reverse a linked list?

Answer Posted / surendra

suppose p is the head pointer.


r=NULL;
while(p)
{
q=r;
r=p;
p=p->next;
r->next=q;
}
p=r;

Is This Answer Correct ?    16 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define the process of handling in case of destructor failure?

569


total amount of milk produced each morning and then calculates and outputs the number of cartons needed for this milk , the cost of producing the milk and the profit from producing this milk.

2078


What is c++ library?

593


Explain the benefits of proper inheritance.

636


Is it legal in c++ to overload operator++ so that it decrements a value in your class?

606






What is while loops?

613


Is c++ vector dynamic?

567


Is dev c++ a good compiler?

524


what is scupper?

1890


Explain abstraction.

612


What do you mean by funtion prototype?

578


Write about the role of c++ in the tradeoff of safety vs. Usability?

589


What is the use of function pointer?

568


Explain polymorphism?

579


How long does it take to get good at leetcode?

653