//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f. pragma solidity ^0.4.18; contract StructArrayInitWrong { event OnCreateRoom(address indexed _from, uint256 _value); struct Room { address[] players; uint256 whosTurnId; uint256 roomState; } Room[] public rooms; function createRoom() public{ Room memory room; address[] memory adds = new address[](1); adds[0]=msg.sender; room.players= adds; room.whosTurnId=0; room.roomState=0; rooms.push(room); //rooms[rooms.length - 1].players.push(msg.sender); OnCreateRoom(msg.sender, 0); } function showAddress(uint index) public view returns (address firstAddress){ return rooms[index].players[0]; } }
0.4.18