Skip to Content
Mastering Blockchain Programming with Solidity
book

Mastering Blockchain Programming with Solidity

by Jitendra Chittoda
August 2019
Intermediate to advanced
486 pages
13h 52m
English
Packt Publishing
Content preview from Mastering Blockchain Programming with Solidity

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.
Start your free trial

You might also like

Mastering Ethereum

Mastering Ethereum

Andreas M. Antonopoulos, Gavin Wood
Complete Cryptocurrency and Blockchain Course | Learn Solidity

Complete Cryptocurrency and Blockchain Course | Learn Solidity

Ravinder Deol, Codestars By Rob Percival, Thomas Wiesner

Publisher Resources

ISBN: 9781839218262Supplemental Content