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 are local variables c?
struct screen_pos{ int row, col } ;move_right(cursor)struct screen_pos *cursor;{ cursor.col++; } /* This statementhas a syntax error */What is the correct statement a) cursor.col = cursor.col + 1; b) col.cursor++; c) *cursor.col++; d) pointer
What are data types in c language?
will u please send me the placement papers to my mail???????????????????
How do you list a file’s date and time?
What do you mean by invalid pointer arithmetic?
What is a void pointer? When is a void pointer used?
Define circular linked list.
What is hungarian notation? Is it worthwhile?
What are enums in c?
Why header file is used in c?
I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.
Write the Program to reverse a string using pointers.
How many levels deep can include files be nested?
What is preprocessor with example?