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
If a round rectangle has straight edges and rounded corners, your roundrect class inherits both from rectangle and from circle, and they in turn both inherit from shape, how many shapes are created when you create a roundrect?
What is private, public and protected inheritance?
What is do..while loops structure?
Which programming language is best?
What does ios :: app do in c++?
Difference between struct and class in terms of access modifier.
Which recursive sorting technique always makes recursive calls to sort subarrays that are about half size of the original array?
Which is not an ANSII C++ function a) sin() b) tmpnam() c) kbhit()
What is the difference between passing by reference and passing a reference?
What are the extraction and insertion operators in c++? Explain with examples.
Write a Program to find the largest of 4 no using macros.
What is the auto keyword good for in c++?
What are the 2 main types of data structures?
What is namespace std; and what is consists of?
Is c++ a low level language?