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

Implement a function that returns the 5th element from the
end in a singly linked list of integers in one pass.

Answer Posted / tarun dhiraj

Consider:
struct Node
{
int data;
struct Node *next;
}*start;

void FIFTHFRMLAST()
{
struct Node *ptr;
ptr=start;

printf("\n");

/*Traverse elements of linked list till the 5th element from
the end of linked list*/
while(ptr->next->next->next->next->next!=NULL)
{
ptr=ptr->next;
}
printf("->%d",ptr->data);

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can type-insensitive macros be created?

1171


I just typed in this program, and it is acting strangely. Can you see anything wrong with it?

1014


What is the purpose of void in c?

1067


What is ponter?

1269


What is #line in c?

1015


How can I find the modification date of a file?

1291


What is pointers in c with example?

1078


How are 16- and 32-bit numbers stored?

1293


Explain what are the __date__ and __time__ preprocessor commands?

1124


When is the “void” keyword used in a function?

1504


What is a node in c?

975


What is equivalent to ++i+++j?

1094


Explain how can you avoid including a header more than once?

1093


all c language question

2442


Explain what is the difference between far and near ?

1112