From the course: C++ Essential Training
Unlock the full course today
Join today to access over 23,400 courses taught by industry experts.
Structures - C++ Tutorial
From the course: C++ Essential Training
Structures
- A structure is an aggregate of variables in C++, it's a simple way of collecting a number of disparate variables in a single container. This is struct.cpp from chapter four of the exercise files. And here we define a simple structure that contains a few different types of variables. Variables in the structure are often called members or sometimes properties. This structure contains three members, an integer, a double and a C-string. The structure itself is simply the definition, it's very much like an aggregate type and it's used as a type in the code. Here, we define a variable or an object based on that structure. So the structure is type capital S and the object is S-one and we're initializing it with this initializer list which simply contains the three different values separated by commas, so the integer, I is three, the double D is 47.9 and the C-string S is string-one. Individual members of the structure are…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Overview of data types3m 21s
-
(Locked)
Integer types2m 43s
-
(Locked)
Floating point types6m 51s
-
(Locked)
The auto type4m 2s
-
(Locked)
Qualifiers4m 33s
-
(Locked)
Type aliases2m 5s
-
(Locked)
Primitive arrays5m 23s
-
(Locked)
C-strings4m 37s
-
(Locked)
Structures2m 50s
-
(Locked)
Challenge: Library card2m 9s
-
(Locked)
Solution: Library card1m 16s
-
-
-
-
-
-
-