0
0
Cprogramming~10 mins

Defining structures - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a structure named Person.

C
struct [1] {
    char name[50];
    int age;
};
Drag options to blanks, or click blank then click option'
APerson
Bperson
CData
DInfo
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or unrelated names for the structure.
Forgetting to name the structure.
2fill in blank
medium

Complete the code to declare a variable of the structure type.

C
struct Person [1];
Drag options to blanks, or click blank then click option'
Avar1
Bp1
Cperson1
DPerson1
Attempts:
3 left
💡 Hint
Common Mistakes
Using the structure name as the variable name.
Using uppercase letters at the start of variable names.
3fill in blank
hard

Fix the error in the structure definition by completing the missing keyword.

C
[1] struct {
    char name[50];
    int age;
} Person;
Drag options to blanks, or click blank then click option'
Adeclare
Bdefine
Cstruct
Dtypedef
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'define' or 'declare' which are not valid keywords here.
Repeating 'struct' unnecessarily.
4fill in blank
hard

Fill both blanks to define and declare a structure variable with typedef.

C
[1] struct Person {
    char name[50];
    int age;
} [2] person1;
Drag options to blanks, or click blank then click option'
Atypedef
BPerson
Cperson1
Dstruct
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'struct' instead of 'typedef' in the first blank.
Using a variable name (like 'person1') instead of the alias name ('Person') in the second blank.
5fill in blank
hard

Fill all three blanks to create a typedef for struct Person and declare a variable.

C
[1] struct Person {
    char name[50];
    int age;
} [2];

[3] p;
Drag options to blanks, or click blank then click option'
Atypedef
BPerson
Dstruct
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'struct' instead of 'typedef' in the first blank.
Using 'struct' instead of the alias in the third blank.
Confusing the alias and variable names.