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 / a.eklare7

int fifth_element_last(node *head)
{
node *p;
int len=0;
p=head;
while(p->next!=NULL)
{
p=p->next;
len++;
}
p=head;
for(int i=1;i<=len-4;i++)
p=p->next;
return(p->data);
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how can you tell whether two strings are the same?

993


What are multibyte characters?

1070


The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this

3524


Explain what does it mean when a pointer is used in an if statement?

1028


What is integer constants?

1032


Write a code of a general series where the next element is the sum of last k terms.

1010


will u please send me the placement papers to my mail???????????????????

1812


Write a program to show the change in position of a cursor using c

1015


When should you use a type cast?

1071


What is boolean in c?

1052


What is data types?

1043


How can a number be converted to a string?

1273


What does != Mean in c?

1005


explain what are actual arguments?

1051


Explain the difference between malloc() and calloc() in c?

1018