Composite type
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. 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.
Fixed array
When we have a fixed size array, we say how many slots we want it to have when we create it. This size will not change. If we create an array that can store 10 integers, it will reserve space for 10 integers...