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
What will the line of code below print out and why?
What should main() return in c and c++?
Carry out conversion of one object of user-defined type to another?
What is a modifier in c++?
What causes a runtime error c++?
What is a string example?
What is iomanip c++?
What is set in c++?
Can you help me with this one? Make a program that when a user inputed a Product Name, it will display its price, and when the user inputed the quantity of the inputed product, it will show its total price. The output must be like this: Product Name: Price: Quantity: Total Price: ..this is the list of products to be inputed: Cellphone - 1500 Washing Machine - 5200 Television - 6000 Refrigirator - 8000 Oven - 2000 Computer - 11000 thanks..:D
What is vector string in c++?
What is the main purpose of overloading operators?
If a base class declares a function to be virtual, and a derived class does not use the term virtual when overriding that class, is it still virtual when inherited by a third-generation class?
Can static member variables be private?
What are the advantages of using typedef in a program?
Can char be a number c++?