how to do in place reversal of a linked list(singly or
doubly)?
Answer Posted / ashish gupta
rev()
{
struct node *a1,*a2,*a3;
if(start->next==NULL) /*Only one element exists*/
return;
a1=start;
a2=a1->next;
a3=a2->next;
a1->next=NULL;
a2->next=a1;
while(a3!=NULL)
{
a1=a2;
a2=a3;
a3=a3->next;
a2->next=a1;
}
start=a2;
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10
What is meant by initialization and how we initialize a variable?
What is extern c used for?
How can you find the exact size of a data type in c?
What is function pointer c?
If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402
Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?
What do you mean by command line argument?
Explain the use of #pragma exit?
What is the difference between far and near ?
How do you print only part of a string?
What is call by value in c?
What is the difference between strcpy() and memcpy() function in c programming?
What is scope rule in c?
an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational