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

Difference between Function to pointer and pointer to function

1063


Is c is a middle level language?

1061


What does return 1 means in c?

1065


Why is c called "mother" language?

1281


Explain what is meant by high-order and low-order bytes?

1044


What is the purpose of main() function?

1241


What is the use of c language in real life?

1019


write a program to find the given number is prime or not

4745


c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above

1035


What do you mean by dynamic memory allocation in c? What functions are used?

1160


Is there any data type in c with variable size?

1094


What is the use of f in c?

976


What is the difference between fread and fwrite function?

1077


What are nested functions in c?

1011


Subtract Two Number Without Using Subtraction Operator

841