Structures

Here is another useful way of storing data: structures. A structure will allow you to store combination of data types which was not possible with arrays.

Structures are another way of grouping together different elements of data, into one named variable. Unlike arrays, in which all elements have to be of the same type, in structures, you can store any combination of any data types you want. Structures can even contain other structures.

Here is what a structure definition looks like:

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy