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

To print the pattern 1 2 3 4 5 10 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9

2198


explain what are pointers?

625


any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above

663


how to find binary of number?

3450


why programs in c are running with out #include? some warnings are display in terminal but we execute the program we get answer why? eg: main() { printf("hello world "); }

1323






Where are local variables stored in c?

576


Explain what is the benefit of using an enum rather than a #define constant?

728


how can use subset in c program and give more example

1507


while initialization of array why we use a[][2] why not a[2][]...?

1872


Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.

840


What is FIFO?

678


Are the outer parentheses in return statements really optional?

581


What is #pragma statements?

595


Is array a primitive data type in c?

584


What is use of bit field?

776