Structures

Learn about C structures that allow storing values of different data types which was not possible with arrays.

Structures are another way of grouping together different types of data, into one named variable. Unlike arrays, in which all elements have to be of the same type, in structures, we can store elements of any combination of data types we want. 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:

Create a free account to access the full course.

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