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