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
write a program fibonacci series and palindrome program in c
What is the deal on sprintf_s return value?
How can you call a function, given its name as a string?
How can you tell whether two strings are the same?
can any one tel me wt is the question pattern for NIC exam
what is event driven software and what is procedural driven software?
How can I check whether a file exists? I want to warn the user if a requested input file is missing.
What is malloc return c?
What does the function toupper() do?
What does s c mean in text?
Explain data types & how many data types supported by c?
What is a pointer on a pointer in c programming language?
main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }
List the difference between a While & Do While loops?
write a program to find the given number is prime or not