当创建结构时,我很难为结构初始化一个空数组。
pragma solidity ^0.5.1;
contract Board {
//storage
Post[] posts;
//struct
struct Post {
address author;
string title;
string content;
Comment[] comments;
}
struct Comment {
address author;
string comment;
}
//add-post
function addPost(address _author, string memory _title, string memory _content) public {
posts.push(Post(_author, _title, _content, /* HERE IS THE PROBLEM POINT */));
}
}
Run Code Online (Sandbox Code Playgroud)
我想用空数组(类型:注释)初始化注释(结构成员)。我应该使用哪个代码来解决问题点?
郎:坚固
谢谢。