Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Write a program in C++ for Fibonacci series

1211


What is a constant? Explain with an example.

1016


What is the best book for c++ beginners?

1047


How many different levels of pointers are there?

1213


Which one is a preferred language C or C++? Why?

1094


What is a float in c++?

985


What doescout<<(0==0) print out a) 0 b) 1 c) Compiler error: Lvalue required

970


What is the need of a destructor? Explain with the help of an example.

1029


What is a wchar_t in c++?

1139


What can I use instead of namespace std?

1156


What is the average salary of a c++ programmer?

1021


What is difference between n and endl in c++?

1096


What is ios flag in c++?

1214


Define virtual constructor.

1095


What is the best c++ book for beginners?

1149