Skip to main content
4 of 4
edited tags; edited title
eth
  • 86.5k
  • 53
  • 287
  • 411

How can I instantiate an array of addresses?

I simply want to create an array with stuff in it. Everything I try is an error message in mist. Even this code snippet I got straight from the docs wont compile:

contract C {
    uint someVariable;
    uint[] data;
    function f() {
        uint[] x = data;
        x.push(2);
    }
}

I simply want to do something that would be analogous to this ruby:

arr = ['0x36eaf79c12e96a3dc6f53426c', '0xf235aa56dd96bda02acfb361e']

I dont need the size to be dynamic, and the type is address.

ZMitton
  • 2.8k
  • 4
  • 19
  • 34