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

How can I implement sets or arrays of bits?

596


What is dynamic dispatch in c++?

552


Explain union.

629


Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..

638


How can I handle floating-point exceptions gracefully?

624






write a c program to calculate sum of digits till it reduces to a single digit using recursion

2712


Write a program to show the change in position of a cursor using c

573


i have a written test for microland please give me test pattern

2173


What is meant by int main ()?

712


What are the different data types in C?

720


What is the use of linkage in c language?

609


Is it valid to address one element beyond the end of an array?

664


Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?

744


In a header file whether functions are declared or defined?

625


What does double pointer mean in c?

569