Skip to content

Instantly share code, notes, and snippets.

@taobun
Created July 31, 2019 08:59
Show Gist options
  • Save taobun/4b6892726cc729129be86f39022c5a9c to your computer and use it in GitHub Desktop.
Save taobun/4b6892726cc729129be86f39022c5a9c to your computer and use it in GitHub Desktop.
Snippet code for allocate memory array
pragma solidity 0.5.10;
contract GenerateArray {
function getZeroArrayLengthFive() public pure returns(uint256[5] memory) {
uint256[5] memory fArray;
return fArray;
}
function getZeroArray(uint256 size) public pure returns(uint256[] memory) {
uint256[] memory fArray = new uint256[](size);
return fArray;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment