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

write a program fibonacci series and palindrome program in c

988


What is the deal on sprintf_s return value?

1077


How can you call a function, given its name as a string?

1109


How can you tell whether two strings are the same?

1215


can any one tel me wt is the question pattern for NIC exam

1928


what is event driven software and what is procedural driven software?

2516


How can I check whether a file exists? I want to warn the user if a requested input file is missing.

1099


What is malloc return c?

981


What does the function toupper() do?

1075


What does s c mean in text?

1065


Explain data types & how many data types supported by c?

1033


What is a pointer on a pointer in c programming language?

1101


main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }

1471


List the difference between a While & Do While loops?

1057


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

4671