Q.

Consider the following definition in c programming language

struct node
{
int data;
struct node * next;
}
typedef struct node NODE;
NODE *ptr;

Which of the following c code is used to create new node?

A. ptr=(node*)malloc(sizeof(node));
B. ptr=(node*)malloc(node);
C. ptr=(node*)malloc(sizeof(node*));
D. ptr=(node)malloc(sizeof(node));
Answer» A. ptr=(node*)malloc(sizeof(node));
4.6k
0
Do you find this helpful?
32

Discussion

No comments yet

Related MCQs