Fill in the blanks to declare a struct and a variable of that type. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 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;

21st Jan 2019, 12:05 PM
İsmail Çavlan
7 Answers
+ 10
Struct ship { int x; int y; } sh1; ______ship*ptr=____sh1; Ptr->x=3; Ptr__y=4;
17th Jun 2022, 2:16 AM
Razia Khatun
Razia Khatun - avatar
+ 1
struct ship { int x; int y; } sh1; struct ship *ptr = sh1; ptr->x = 3; ptr -> y = 4; Incorrect, try again!
15th Oct 2022, 5:23 PM
KIKKARA SONIYA
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
15th Oct 2022, 3:41 AM
NARESH M
NARESH M - avatar
0
struct ship { int x; int y; } sh1; struct ship *ptr = &sh1; ptr->x = 3; ptr->y = 4;
9th Dec 2022, 6:23 PM
Nikhil kokate
Nikhil kokate - avatar
- 1
struct small
4th May 2022, 5:12 AM
JENISH H VEKARIYA
JENISH H VEKARIYA - avatar
- 4
Typedef, shape
9th Mar 2022, 6:24 AM
Varshitha Vobbilisetty
- 25
... Are you posting answers to lesson practices, in the Q&A?
21st Jan 2019, 12:06 PM
Hatsy Rei
Hatsy Rei - avatar