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
What is the use of static variable in c?
Stimulate calculator using Switch-case-default statement for two numbers
Give basis knowledge of web designing ...
in linking some of os executables are linking name some of them
How can my program discover the complete pathname to the executable from which it was invoked?
What are two dimensional arrays alternatively called as?
What are the 32 keywords in c?
What does *p++ do? What does it point to?
What is infinite loop?
Is it better to bitshift a value than to multiply by 2?
How can you allocate arrays or structures bigger than 64K?
What is a scope resolution operator in c?
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.
What are the key features in c programming language?
What does the && operator do in a program code?