You need to use an array in storage because it is not possible to resize memory arrays.html
contract D { uint[] myArray; function Test() constant returns (uint[]) { myArray.push(123); return myArray; } }
Otherwise you need to define the size of the array during initialization:ui
contract C { function f(uint len) { uint[] memory a = new uint[](7); bytes memory b = new bytes(len); // Here we have a.length == 7 and b.length == len a[6] = 8; } }
https://solidity.readthedocs.io/en/develop/types.html#allocating-memory-arrayscode