You are viewing a single comment's thread from:

RE: Solidity实用笔记

in #starnote5 years ago (edited)

memory storage
memory 存储在EVM内存中,主要有局部变量,函数参数
storage 存储在区块链中,主要有状态变量,复杂变量,数组

pragma solidity >0.4.23 <0.7.0;

contract MyStorage{
    int[] arr;
    string tt;
    function fun1(uint m, string memory s) public returns(string memory) {
        uint n = m;
        string memory str = s;
        tt = s;
        
        string memory s1 = 'abc';
        string memory s2 = s1;
        
        int[] storage abc = arr;
        return tt;
    }
}