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
What are the similarities between c and c++?
what will be the output for the following main() { printf("hi" "hello"); }
What is the purpose of void pointer?
Simplify the program segment if X = B then C ← true else C ← false
Can the “if” function be used in comparing strings?
What is a static function in c?
#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??
a=10;b= 5;c=3;d=3; if(a printf(%d %d %d %d a,b,c,d) else printf("%d %d %d %d a,b,c,d);
Explain what are multibyte characters?
What is the difference between exit() and _exit() function?
Describe the header file and its usage in c programming?
What is const keyword in c?
Explain what is wrong in this statement?
Is return a keyword in c?
Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)