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

Why c++ is faster than java?

1105


what is upcasting in C++?

1233


What is general format for a prototype?

1091


If you push the numbers (in order) 1, 3, and 5 onto a stack, which pops out first a) 1 b) 5 c) 3

1427


What is using namespace std in c++?

1205


How do you find out if a linked-list has an end? (I.e. The list is not a cycle)

1218


What is singleton pattern in c++?

1045


Why c++ is the best language?

1114


What is meant by const_cast?

1175


Can the creation of operator** is allowed to perform the to-the-power-of operations?

1052


Write down the equivalent pointer expression for referring the same element a[i][j][k][l]?

1323


Which is best c++ or java?

1139


Can a Structure contain a Pointer to itself?

1201


What is constructor in C++?

1143


How are Structure passing and returning implemented by the compiler?

1201