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...

How many pointers are required to reverse a link list?

Answer Posted / patrick

You cannot must have a pointer to a pointer if you want to
modify the pointer.

void reverse(node** head)
{
node* cur = *head;
*head = null;

while (cur)
{
node* next = cur->next;
cur->next = *head;
*head = cur;
cur = next;
}
}

Besides the head pointer, you will need two local pointers.

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between function overloading and operator overloading?

1031


What is java and c++?

1087


What is implicit pointer in c++?

1028


Differentiate between the manipulator and setf( ) function?

1092


Explain the difference between c & c++?

1018


Function can be overloaded based on the parameter which is a value or a reference. Explain if the statement is true.

1058


what does the following statement mean? int (*a)[4]

1028


Describe Trees using C++ with an example.

1085


Why c++ is created?

949


What is class definition in c++ ?

1026


How do you define a class in c++?

1025


What's c++ used for?

1050


Is java easier than c++?

950


What is runtime polymorphism in c++?

1082


True or false, if you keep incrementing a variable, it will become negative a) True b) False c) It depends

2308