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 associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
Wt are the Buses in C Language
What is int main () in c?
What will the preprocessor do for a program?
what is stack , heap ,code segment,and data segment
What functions are used in dynamic memory allocation in c?
Is c call by value?
What is merge sort in c?
What are the different types of linkage exist in c?
define string ?
What are different types of variables in c?
What is the difference between printf and scanf in c?
What is the difference between āgā and āgā in C?
What is sizeof array in c?
How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?