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 do you mean by friend class & friend function in c++?

1113


What is the basic structure of c++ program?

1153


What is the error in the code below and how should it be corrected?

821


Is c++ a good beginners programming language?

1125


How does c++ sort work?

1025


Explain how the virtual base class is different from the conventional base classes of the opps.

1210


What do c++ programmers do?

1108


How we can differentiate between a pre and post increment operators during overloading?

1154


Define virtual constructor.

1143


What you know about structures in C++?

1141


What is the use of cmath in c++?

1120


What is the latest version on c++?

1182


What is using namespace std in c++?

1206


What character terminates all character array strings a) b) . c) END

1348


Why do we use the using declaration?

1235