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

Answer Posted / abdur rab

struct node* reverse ( struct node* head )
{
struct node* temp;

if ( NULL == head -> next ) temp = head;
else {
temp = reverse ( head -> next );
head -> next -> next = head;
head -> next = NULL;
}
return ( temp );
}

Is This Answer Correct ?    0 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above

646


Tell me what are bitwise shift operators?

648


write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays

1777


Write a program that accept anumber in words

1244


Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix

1506






How can you tell whether two strings are the same?

820


What is the size of enum in bytes?

576


Who is the main contributor in designing the c language after dennis ritchie?

541


1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. 2) the Event Manager has to send participants to the stage to perform in the order in which they registered. Write a program that will help the Event Manager know who to call to the stage to perform. The Logic should be in Data Structures

2733


What is the use of in c?

568


What are preprocessor directives?

665


What is a stream?

639


What are the uses of a pointer?

672


Is c is a procedural language?

587


How are pointers declared in c?

590