Composite Types: Fixed and Dynamic Arrays
Learn about composite types and the difference between fixed and dynamic arrays.
We'll cover the following
Composite types
Sometimes, we need to store more than one value at a time. To do this, we can use what are called composite types.
A composite type is a data type that is made up of more than one value. There are situations when keeping several related values together makes sense. In our everyday life, we do this often. A shopping list is an example of this. Instead of having several papers, each one having one item we need to buy, we store all the items on one piece of paper and call this a list.
This is how a composite type works in programming as well. We have several types that all have some specific characteristics. The first one can be used when we want to represent a sequence or list of things. This is often called an array.
An array—also called a vector, list, or sequence—is a data type that stores several elements. This number can be fixed or flexible.
Get hands-on with 1400+ tech skills courses.