Solidity Data Types: Complex Types
Learn the different complex data types for variable declarations in Solidity.
We'll cover the following
Complex types are combinations or variants of value types. They are also known as reference types because variables of these types don't directly store values but addresses (such as references) to the data they store.
Arrays: <type>[]
It's possible to arrange data of any type T
in an array.
An array can have a fixed size k
by declaring it with T[k]
, or a dynamic size by declaring it with T[]
.
We can also declare a multidimensional array, such as an array of arrays, using the syntax T[][]...[]
.
For instance, in the following contract, we declare a one-dimensional array of three booleans, a dynamic-sized array of addresses, and a dynamic-sized array of arrays that contain five unsigned integers each.
Get hands-on with 1400+ tech skills courses.