我如何初始化一个包含空地址数组的结构?

How I can initialize a struct with an empty address array in it?

pragma solidity >=0.4.22 <0.7.0;

contract Storage {

    struct Client {
        bool enrolled;
        bytes32 fullName;
        address[] reference;
    }

    Client newClient = Client(true, 0x7465737400000000000000000000000000000000000000000000000000000000, address[]);
}

这是代码,经过简化。我知道...最好的解决方案是更改所有内容并用映射替换数组。但是我需要这样做。

有什么想法吗?

试试这个 - 大括号中的 0 表示您正在初始化一个大小为 0 的动态数组。

Client newClient = Client(true, 0x7465737400000000000000000000000000000000000000000000000000000000, new address[](0));