title: How do I pass an array to a constructor?
body: <p>I want to pass an array to a constructor, but only the first value is passed--the rest looks like garbage.</p>
  
  <p>Here's a simplified version of what I'm working on:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  class board
  {
      public:
          int state[64];
          board(int arr[])
          {
              *state = *arr;
          }
          void print();
  };
  
  void board::print()
  {
      for (int y=0; y&lt;8; y++)
      {
          for (int x=0; x&lt;8; x++)
              std::cout &lt;&lt; state[x + y*8] &lt;&lt; " ";
          std::cout &lt;&lt; "\n";
      }
  }
  
  int main()
  {
      int test[64] = {
          0, 1, 2, 3, 4, 5, 6, 7,
          1, 2, 3, 4, 5, 6, 7, 8,
          2, 3, 4, 5, 6, 7, 8, 9,
          3, 4, 5, 6, 7, 8, 9,10,
          4, 5, 6, 7, 8, 9,10,11,
          5, 6, 7, 8, 9,10,11,12,
          6, 7, 8, 9,10,11,12,13,
          7, 8, 9,10,11,12,13,14 };
  
      board b(test);
      b.print();
  
      std::cin.get();
      return 0;
  }
  </code></pre>
  
  <p>Can someone explain why this doesn't work and how to properly pass an array? Also, I don't want to copy the array. (And do I really have to indent every line by 4 spaces for code? That's pretty tedious.)</p>