December 2018
Beginner to intermediate
564 pages
17h 34m
English
Solidity supports both generic and byte arrays. It supports both fixed size and dynamic arrays. It also supports multidimensional arrays.
bytes1, bytes2, bytes3, ..., bytes32 are types for byte arrays. byte is an alias for bytes1.
Here is an example that shows generic array syntaxes:
contract sample{ //dynamic size array //wherever an array literal is seen a new array is created. If the array literal is in state than it's stored in storage and if it's found inside function than its stored in memory //Here myArray stores [0, 0] array. The type of [0, 0] is decided based on its values. //Therefore you cannot assign an empty array literal. int[] myArray = [0, 0]; function sample(uint index, int value){ //index of an array should ...Read now
Unlock full access