πŸ“Š Data Structure and Algorithms (DSA)
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));
πŸ’¬ Discuss
βœ… Correct Answer: (A) ptr=(node*)malloc(sizeof(node));

You must be Logged in to update hint/solution

πŸ’¬ Discussion

πŸ“Š Question Analytics

πŸ‘οΈ
825
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
80%
Success Rate