else
{printf("%d ", head–>data*21); }
}
void xy2(struct abc* start)
{ if(start == NULL)
return;
if(start–>next != NULL )
xy2(start–>next–>next);
if((start–>data%2==0))
{printf("%d ", start–>data*3); }
else
{printf("%d ", start–>data*12); }
}
void p(struct abc** head_ref, int new_data)
{ struct abc* new_node =(struct abc*) malloc(sizeof(struct abc));
new_node–>data = new_data;
new_node–>next = (*head_ref);
(*head_ref) = new_node;
}
int main()
{ struct abc* head = NULL;
p(&head, 21);
xy1(head);
xy2(head);
getchar();
return 0;
}
" class="related-a">
What will be the output of the following code?
#include<stdio.h>
#include<stdlib.h>
struct abc
{ int data;
struct abc *next;
};
void xy1(struct abc* head)
{ if(head == NULL)
return;
xy1(head–>next);
if ((head–>data)%2==0)
{printf("%d ", head–>data*31);}
else
{printf("%d ", head–>data*21); }
}
void xy2(struct abc* start)
{ if(start == NULL)
return;
if(start–>next != NULL )
xy2(start–>next–>next);
if((start–>data%2==0))
{printf("%d ", start–>data*3); }
else
{printf("%d ", start–>data*12); }
}
void p(struct abc** head_ref, int new_data)
{ struct abc* new_node =(struct abc*) malloc(sizeof(struct abc));
new_node–>data = new_data;
new_node–>next = (*head_ref);
(*head_ref) = new_node;
}
int main()
{ struct abc* head = NULL;
p(&head, 21);
xy1(head);
xy2(head);
getchar();
return 0;
}