Question: A point structure and the pointer to this structure r are defined below in C. Which statement related to r is wrong? struct point {

A point structure and the pointer to this structure r are defined below in C. Which statement related to r is wrong?

struct point

{

int x;

int y;

};

struct point *r;

A) r = (point *)malloc (sizeof(struct point));

B) r = (point *)malloc (sizeof(struct point) * 3)

C) r.x = 1; (Assume a correct malloc function has been written)

D) r->x = 1; (Assume a correct malloc function has been written)

Can someone please explain me how do this?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!