Lesson 18 of 50
cStructures (`struct`)
10 mins
Course progress36%
What you'll learn
Keep these ideas in mind as you work through the lesson.
Lesson 18 of 50
c10 mins
Keep these ideas in mind as you work through the lesson.
struct groups different data types into a single composite type.
struct Point {
double x;
double y;
};
struct Point p1 = { .x = 3.0, .y = 4.0 };
You can create typedefs for shorter names and nest structs. Use the . operator to access members, or -> when you have a pointer to a struct.