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
Can a local variable be volatile in c?
How to write a multi-statement macro?
What is .obj file in c?
which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above
Can a function argument have default value?
What are different types of pointers?
Is it better to use malloc() or calloc()?
pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)
What is #include conio h?
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.
How to throw some light on the b tree?
Why ca not I do something like this?
what are the 10 different models of writing an addition program in C language?
What are the functions to open and close file in c language?
What is merge sort in c?