can i know the source code for reversing a linked list with
out using a temporary variable?
Answer Posted / dinakaran gct
#include<stdio.h>
struct node *head;
void main();
{
//consider head is the first node
reverse(head);
//here print the reversed link list ...thank you;
}
reverse(struct node *cur)
{
if(cur->next==NULL)
reveres(cur->next)
else{temp=head=cur;}
temp->next=cur;
temp=temp->next;
temp->next=NULL;
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
Is null valid for pointers to functions?
Can a variable be both const and volatile?
What's the best way of making my program efficient?
Explain is it better to bitshift a value than to multiply by 2?
Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1
How do you define structure?
What are the advantages and disadvantages of c language?
What are reserved words?
How to throw some light on the b tree?
how we can make 3d venturing graphics on outer interface
where are auto variables stored? What are the characteristics of an auto variable?
Is the exit() function same as the return statement? Explain.
which is conditional construct a) if statement b) switch statement c) while/for d) goto
Can you return null in c?
What is the use of function overloading in C?