Most computer languages support various data types.
Elementary data types, such as integers, floats, booleans and chars can represent a single value (such as a number or a letter).
[10, 20, 30]
Composite data types can be either static or dynamic. Static structures have a fixed size that is determined when the structure is created (arrays are static). Dynamic structures can grow to accommodate more data after they have been created (lists are usually dynamic).
Storing composite data types in memory can be quite complicated. For example, if you wanted to store a list, you would need to store:
The collection of all these values is called a data structure.
Data structures typically have built in code to manage them. For example with a list you have to worry about what happens if you add extra elements to the list - will there be enough memory to store all the data, and what do you do if you need more? In fact there are several different ways to create a list, such as array lists or linked lists.
Fortunately, you don't usually need to create your own data structures. Most languages provide a set of abstract data types that you can use without needing to worry about how they work.
Copyright (c) Axlesoft Ltd 2020