Using arrays in Solidity
In Solidity, arrays can be fixed size or dynamic size. We have already seen in the previous sections, Fixed size byte arrays and Dynamically sized byte, arrays of this chapter that bytes and string are special types of array.
You can set the visibility of an array to public and have Solidity create a getter function for it automatically. As you can see in the following ArraysExample contract, the owners array is set to public. Anyone would be able to access the owner's array outside of the contract as well, even without using any function.
Creating arrays using new—you can create variable length, in memory arrays using the new keyword. It is not possible to resize these memory arrays. You can create memory arrays ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access