Recall & Review
beginner
What is a structure in C?
A structure in C is a user-defined data type that groups different variables under one name. These variables can be of different types and are called members.
Click to reveal answer
beginner
How do you define a structure in C?
You use the keyword
struct followed by the structure name and curly braces containing member declarations. For example:<br>struct Point {<br> int x;<br> int y;<br>};Click to reveal answer
beginner
How do you create a variable of a structure type?
After defining a structure, you create variables by specifying the structure name. For example:<br>
struct Point p1;creates a variable
p1 of type struct Point.Click to reveal answer
beginner
How do you access members of a structure variable?
Use the dot operator
. to access members. For example, p1.x = 10; sets the x member of p1.Click to reveal answer
beginner
Can structures contain different data types as members?
Yes, structures can have members of different types, like
int, float, char, or even other structures.Click to reveal answer
Which keyword is used to define a structure in C?
✗ Incorrect
The keyword
struct is used to define structures in C.How do you access the member 'age' of a structure variable 'person'?
✗ Incorrect
Use the dot operator:
person.age to access members of a structure variable.What is the correct way to declare a structure variable named 'car' of type 'struct Vehicle'?
✗ Incorrect
The correct syntax is
struct Vehicle car;.Can a structure contain members of different data types?
✗ Incorrect
Structures can contain members of different data types.
Which of the following is a valid structure definition?
✗ Incorrect
Structures are defined using curly braces
{ }, like in option C.Explain how to define a structure and create a variable of that structure in C.
Think about the syntax using 'struct' and how you name and use the structure.
You got /5 concepts.
Describe how you can use structures to group different types of data together.
Imagine a structure as a box holding different things related to one object.
You got /4 concepts.