Write a program to reverse a linked list?
Answer Posted / prakash d
struct node *ptr1,*ptr2,*ptr3;
ptr1=start; //pointer points to starting node.
ptr2=ptr1->next;
ptr3=ptr2->next;
ptr1->next=NULL;
ptr2->next=ptr1;
while(ptr3!=NULL)
{
ptr1=ptr2;
ptr2=ptr3;
ptr3=ptr3->next;
ptr2->next=ptr1;
}
start=ptr2;
Is This Answer Correct ? | 13 Yes | 6 No |
Post New Answer View All Answers
Explain the extern storage classes in c++.
What are vectors used for in c++?
What is ctime c++?
What is a type library?
What is setfill c++?
In c++, what is the difference between method overloading and method overriding?
What are arithmetic operators?
Write a c program for binary addition of two 8 bit numbers.
what are the decision making statements in C++? Explain if statement with an example?
Is c++ proprietary?
Write a program which uses functions like strcmp(), strcpy()? etc
How are pointers type-cast?
What is rtti in c++?
What gives the current position of the put pointer?
Write a note about the virtual member function?