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

What is the use of static variable in c?

1044


Stimulate calculator using Switch-case-default statement for two numbers

2922


Give basis knowledge of web designing ...

1981


in linking some of os executables are linking name some of them

2075


How can my program discover the complete pathname to the executable from which it was invoked?

1034


What are two dimensional arrays alternatively called as?

1133


What are the 32 keywords in c?

1042


What does *p++ do? What does it point to?

1004


What is infinite loop?

1028


Is it better to bitshift a value than to multiply by 2?

1050


How can you allocate arrays or structures bigger than 64K?

1083


What is a scope resolution operator in c?

1205


When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.

1934


What are the key features in c programming language?

1005


What does the && operator do in a program code?

1159