josh technology
Company
Programming
#include
struct node
{
int value ;
struct node *next;
};
/*void fun(int *p)
{
int q=10;
printf("function %dn",*p);
p=&q;
printf("function %dn",*p);
}*/
void rearrange(struct node *list)
{
struct node *p,*q;
int temp;
if((!list)||!list->next)
return;
p=list;
q=list->next;
while(q)
{
temp=p->value;
p->value=q->value;
q->value=temp;
p=q->next;
q=p?p->next:0;
}
}
Read Solution (Total 4)
-
- swapping two adjacent node values........
- 8 years agoHelpfull: Yes(1) No(0)
- where is main function?
- 8 years agoHelpfull: Yes(0) No(0)
- There is no main function from where the calling is initiated. But in rearrange function, it is something like swapping of two node in a linked list.
- 8 years agoHelpfull: Yes(0) No(0)
- 2,1,4,3,6,5,7
The function rearrange()exchange data of every node with its next node it starts exchanging data from the first node itself . - 5 years agoHelpfull: Yes(0) No(0)
josh technology Other Question