solidity智能合约[16]-固定长度数组
数组
内存中的一片连续区域
定义
1 |
int[7] math; |
赋值
1 |
uint[5] public grade =[1,2,3,4,5]; |
修改内容
1 |
function init2() public { |
返回数组
1 |
function getArray2() public view returns(bytes2[3]){ |
获取数组长度
1 |
function getlength() public view returns(uint){ |
数组遍历求和
1 |
function add() public view returns(uint){ |
错误代码
固定数组不能修改大小和内容
1 |
|
完整例子
1 |
pragma solidity ^0.4.23; |
本文链接: https://dreamerjonson.com/2018/11/19/solidity-16-fixarray/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY 4.0 CN协议 许可协议。转载请注明出处!