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
a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.
What is actual argument?
How to define structures? ·
Explain bitwise shift operators?
What is sizeof in c?
Explain what will the preprocessor do for a program?
What is the scope of local variable in c?
How can a program be made to print the line number where an error occurs?
i got 75% in all semester am i eligible for your company
What is a list in c?
Explain how can I avoid the abort, retry, fail messages?
What is bubble sort technique in c?
Tell me when is a void pointer used?
Write a program to check armstrong number in c?
What do you mean by dynamic memory allocation in c?