how to do in place reversal of a linked list(singly or
doubly)?

Answer Posted / divakar & venkatesh

int reverse()
{
node *r,*s,*q;
s=NULL;
q=p;
while(q!=NULL)
{
r=q;
q=q->link;
r->link=s;
s=r;
}
p=r;
return;
}
this is reverse fun for single linked list.

Is This Answer Correct ?    7 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Describe dynamic data structure in c programming language?

612


What does malloc () calloc () realloc () free () do?

570


A text file that contains declarations used by a group of functions,programs,or users a) executable file b) header file c) obj file d) .cfile

655


What does int main () mean?

560


How is actual parameter different from the formal parameter?

602






What is a void pointer? When is a void pointer used?

641


Why array is used in c?

564


What is the scope of global variable in c?

564


What are the two types of functions in c?

579


How are variables declared in c?

607


what is the difference between 123 and 0123 in c?

733


Define Array of pointers.

644


Define recursion in c.

708


Is there a built-in function in C that can be used for sorting data?

751


How can a program be made to print the line number where an error occurs?

661