Implement a function that returns the 5th element from the
end in a singly linked list of integers in one pass.
Answer Posted / a.eklare7
int fifth_element_last(node *head)
{
node *p;
int len=0;
p=head;
while(p->next!=NULL)
{
p=p->next;
len++;
}
p=head;
for(int i=1;i<=len-4;i++)
p=p->next;
return(p->data);
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is the difference between fread and fwrite function?
Explain what is wrong in this statement?
What is abstract data structure in c?
how to make a scientific calculater ?
How can I recover the file name given an open stream or file descriptor?
What is unsigned int in c?
Difference between MAC vs. IP Addressing
Which type of language is c?
What is the best style for code layout in c?
Can we access array using pointer in c language?
Are negative numbers true in c?
What is #define used for in c?
How would you obtain the current time and difference between two times?
Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)
Is c programming hard?