struct node
{
int *a;
char *b;
char array[12];
};
struct node m,*n;

assign the value in *a,*b,char array[12]

Answer Posted / varun

m.a=(int*)malloc(4);
*(m.a)=2;
m.b=(char*)malloc(10);
m.b="hello";
strcpy(m.array,"world");
n=(struct node*)malloc(sizeof(struct node));
n->a=(int*)malloc(4);
*(n->a)=2;
n->b=(char*)malloc(10);
n->b="hello";
strcpy(n->array,"world");

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can a local variable be volatile in c?

784


How to write a multi-statement macro?

838


What is .obj file in c?

860


which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above

1442


Can a function argument have default value?

925


What are different types of pointers?

800


Is it better to use malloc() or calloc()?

860


pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)

2441


What is #include conio h?

807


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

3753


How to throw some light on the b tree?

835


Why ca not I do something like this?

809


what are the 10 different models of writing an addition program in C language?

1684


What are the functions to open and close file in c language?

971


What is merge sort in c?

852