Question: Consider the following declaration: struct Length { int yards; int feet; int inches; }; Define variable lenp as follows: Length *lenp; Suppose we dinamically allocated

Consider the following declaration:

struct Length {

int yards;

int feet;

int inches;

};

Define variable lenp as follows: Length *lenp;

Suppose we dinamically allocated a struct Length as follows: lenp = new Length;

Which of the following will correctly set the yards field of *lenp to 3 yards?

a.

lenp.yards = 3

b.

(*lenp).yards = 3

c.

*lenp->yards = 3

d.

(*lenp)->yards = 3

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!