Implement a function that returns the 5th element from the
end in a singly linked list of integers in one pass.
Answer Posted / vignesh1988i
let us assume that we have created a linked lists ..... the
no. of nodes is say 15.
count=15;
printf("enter the node do you wann to look out :\n");
scanf("%d",&i);
if(i>count || i>=0)
printf("no node exists like this \n");
else
{
i=count-i;
view_node(i);
printf("%d",HEAD1->data);
}
getch();
}
void view_node(int i)
{
HEAD1=HEAD;
for(int k=1;k<i;k++)
HEAD1=->HEAD1->ptr;
}
| Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
Describe how arrays can be passed to a user defined function
Can you please explain the difference between syntax vs logical error?
Can a function argument have default value?
Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?
What is methods in c?
How can you find the exact size of a data type in c?
Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
Explain a pre-processor and its advantages.
What are conditional operators in C?
What do you mean by Recursion Function?
How can my program discover the complete pathname to the executable from which it was invoked?
What is bubble sort in c?
Why we write conio h in c?
How can I send mail from within a c program?
Explain how do you sort filenames in a directory?