- 4
Fill in the blanks to declare a struct and a variable of that type.
typedef struct { int width; int height; } shape; shape sh; sh.width = 3; sh.height = 4;
7 Answers
+ 11
Struct ship {
int x;
int y;
} sh1;
______ship*ptr=____sh1;
Ptr->x=3;
Ptr__y=4;
+ 1
struct ship {
int x;
int y;
} sh1;
struct
ship *ptr =
sh1;
ptr->x = 3;
ptr
->
y = 4;
Incorrect, try again!
0
Fill in the blanks to declare a pointer to a structure and access the structure members using the pointer:
struct Point {
int x;
int y;
} p1;
struct Point
ptr = &p1;
ptr->x = 3;
ptr
y = 4;
Smashed it
0
struct ship {
int x;
int y;
} sh1;
struct ship *ptr = &sh1;
ptr->x = 3;
ptr->y = 4;
- 1
struct
small
- 3
Typedef, shape
- 25
... Are you posting answers to lesson practices, in the Q&A?