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
How can type-insensitive macros be created?
I just typed in this program, and it is acting strangely. Can you see anything wrong with it?
What is the purpose of void in c?
What is ponter?
What is #line in c?
How can I find the modification date of a file?
What is pointers in c with example?
How are 16- and 32-bit numbers stored?
Explain what are the __date__ and __time__ preprocessor commands?
When is the “void” keyword used in a function?
What is a node in c?
What is equivalent to ++i+++j?
Explain how can you avoid including a header more than once?
all c language question
Explain what is the difference between far and near ?