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
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)
Why does not c have an exponentiation operator?
What is scope rule of function in c?
Explain modulus operator.
I have a varargs function which accepts a float parameter?
How do you list a file’s date and time?
Explain what is the purpose of "extern" keyword in a function declaration?
Combinations of fibanocci prime series
Explain how do you determine a file’s attributes?
What is fflush() function?
Define macros.
Is that possible to add pointers to each other?
What is typedef struct in c?
How can I check whether a file exists? I want to warn the user if a requested input file is missing.
Explain that why C is procedural?