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
Explain what is the benefit of using an enum rather than a #define constant?
What is local and global variable in c?
What is the correct code to have following output in c using nested for loop?
What is self-referential structure in c programming?
What are loops c?
What is a keyword?
What are the benefits of c language?
Explain how can you avoid including a header more than once?
What are the __date__ and __time__ preprocessor commands?
What is a structure in c language. how to initialise a structure in c?
What is calloc() function?
How many bytes are occupied by near, far and huge pointers (dos)?
Differentiate between declaring a variable and defining a variable?
What are the different types of linkage exist in c?
Explain heap and queue.