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
Explain how do you print an address?
Which type of language is c?
What is use of #include in c?
Difference between Shallow copy and Deep copy?
Is null valid for pointers to functions?
what do the 'c' and 'v' in argc and argv stand for?
List the difference between a "copy constructor" and a "assignment operator"?
What are the types of operators in c?
Explain built-in function?
Who invented b language?
Write a code to generate divisors of an integer?
Why ca not I do something like this?
what are bit fields in c?
What are the similarities between c and c++?
How to declare a variable?