Structures
Learn about C structures that allow you to store values of different data types, something that wasn’t possible with arrays.
We'll cover the following...
We'll cover the following...
Structures are another way of grouping together different types of data, into one named variable. Unlike arrays, where all elements have to be of the same type, structures allow us to store elements of any combination of data types. Structures can even contain other structures.
To use a structure in C, we first need to define its data type. Here is an example of what a definition looks like:
Press + to interact
struct Point3D {int x;int y;int z;};
The struct
keyword tells ...