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
Get step-by-step solutions from verified subject matter experts
