10 Type uint8[2] memory is not implicitly convertible to expected type int256[2] storage ref

image.png

image.png

如图,请问怎么解决这个问题呢?我知道把int256[2]换成uint256[2]就行了,但是我的需求必须将其设置为int。

请先 登录 后评论

最佳答案 2022-03-31 15:22

你可以这样初始化

contract Test {

    int256[2] public aaa;

    constructor() {
        aaa[0] = 111;
        aaa[1] = 222;
    }

}
请先 登录 后评论

其它 2 个回答

雨宫莲
请先 登录 后评论
Ethereal - Solidity智能合约开发工程师
请先 登录 后评论
  • 3 关注
  • 0 收藏,2531 浏览
  • happypl 提出于 2022-03-31 14:51

相似问题