1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| pragma solidity ^0.4.23;
contract structTest{
struct student{ uint grade; string name; }
struct student2{ uint grade; string name; student ss; }
struct student3{ uint grade; string name; student ss; student3[] stu;
}
struct student4{ uint grade; string name; student ss; student3[] stu; mapping(uint=>student4) studentMap; }
function init() public pure returns(uint,string){ student memory s = student(100,"jackson"); student3[3] memory stu; return (s.grade,s.name); }
function init2() public pure returns(uint,string){ student memory s = student({name:"jackson",grade:100}); return (s.grade,s.name); } }
|