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 is data binding in c++?
What is the difference between #import and #include?
Search for: what is pair in c++?
When are exception objects created?
What is functions syntax in c++?
What is an arraylist c++?
What is the difference between the indirection operator and the address of oper-ator?
Is c++ the hardest programming language?
What c++ library is string in?
What is the difference between strcpy() and strncpy()?
Write a single instruction that will store an EVEN random integer between 54 and 212 inclusive in the variable myran. (NOTE only generate EVEN random numbers)
How do you differentiate between overloading the prefix and postfix increments?
Which one is better- macro or function?
Define namespace in c++?
Is swift faster than go?