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
Why void is used in c?
What are the types of arrays in c?
What is a char c?
Is flag a keyword in c?
How does normalization of huge pointer works?
show how link list can be used to repersent the following polynomial i) 5x+2
What is null pointer in c?
Tell me when would you use a pointer to a function?
What is the difference between fread buffer() and fwrite buffer()?
what is the function of pragma directive in c?
What is a string?
What does %c mean in c?
What are the different types of control structures?
What is 2 d array in c?
What is #include called?