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

Which bit wise operator is suitable for turning off a particular bit in a number?

1064


Can you please explain the difference between using macro and inline functions?

1007


How do you add an element to a set in c++?

942


Why do we use the using declaration?

1127


What are virtual constructors/destructors?

957


What are the 3 levels of programming languages?

998


What is the use of seekg in c++?

999


What are the differences between the function prototype and the function defi-nition?

1052


Why c++ is created?

958


What is the c++ code?

1094


How a new element can be added or pushed in a stack?

971


Explain polymorphism?

1038


What is pure virtual function? Or what is abstract class?

1010


Can we inherit constructor in c++?

1033


What does return 0 do in c++?

989