can i know the source code for reversing a linked list with
out using a temporary variable?

Answer Posted / vishnu948923

struct node* reverse(struct node* first)
{
struct node* cur, temp;
cur=NULL;
while(first!=NULL)
{
temp=first;
first=first->link;
temp->link=cur;
cur=temp;
}
return cur;
}

Is This Answer Correct ?    5 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the 32 keywords in c?

639


What is the benefit of using #define to declare a constant?

611


write a program to create a sparse matrix using dynamic memory allocation.

4376


What is structure in c definition?

579


What is the mean of function?

653






How do I copy files?

627


Describe static function with its usage?

616


write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);

1853


write an algorithm to display a square matrix.

2229


How can I avoid the abort, retry, fail messages?

665


#include main() { char s[] = "Bouquets and Brickbats"; printf(" %c, ",*(&s[2])); printf("%s, ",s+5); printf(" %s",s); printf(" %c",*(s+2)); }

670


What is the difference between fread buffer() and fwrite buffer()?

676


How many types of errors are there in c language? Explain

577


Which type of language is c?

656


Explain the advantages and disadvantages of macros.

631