What is address[] in solidity?

I found it in a tutorial video I watched but I am unable to find any information about this on internet! Does anyone knows?

3 Answers 3


address[] is a type, an array of addresses. You can think of it as a list of addresses.

The square brackets, [], are use to specify that this type is an array.

You can create an array of many things, like an array of uint256 numbers:

uint256[] numbers;

And many more with a similar syntax.

Many languages use the [] to create or declare an array. Like Javascript: const numbers = [];. We can usually initiate an array with values, like in js: const numbers = [1,2,3,4,5];. In Solidity it would look like this for an array of uint256 numbers in storage: uint256[] numbers = [1,2,3,4];

In your case, an array of addresses can be declared as a state variable as follows:

address[] admins;

And then, in another function you can add addresses to that array:

function addAdmin(address adminAddress) public onlyOwner {

Of if you know the address before hand you can hard code them while you declare the array of addresses, like this:

address[] admins = [0x66B0b1d2930059407DcC30F1A2305435fc37315E, 0x6827b8f6cc60497d9bf5210d602C0EcaFDF7C405];

Arrays are really useful to hold a collection of things, objects, numbers, addresses, strings, etc.

We access arrays by index, starting at index 0 for the first element in most programming languages. If I want to access the first element of the array, then I do:


For the second:


And so on. Or in a loop:

for(uint256 i = 0; i < admins.length; i++) {
  address adminAddress = admins[i];
  // ...
  // do something with adminAddress

And so on.

Solidity has many rules for arrays. State and local arrays are usually declared differently and used a bit differently in some cases. To learn more about them you can check the documentation: https://docs.soliditylang.org/en/latest/types.html#arrays

I hope it has helped.


In Solidity, address[] is an array consisting of addresses.

See: How can I instantiate an array of addresses?


In Solidity, address[] is an array of type address. An address in Solidity is a data type that represents a 20-byte Ethereum address. Arrays in Solidity are a type of data structure that allows you to store and manage a collection of data. In this case, an address[] array would be used to store a collection of Ethereum addresses.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.