title: C++ - Initializing an empty array on class
body: <p>i'm having some trouble on initializing an empty array ,or so i call it, in a class. basically i want to fill a 2d array with 0.</p>
  
  <p>here's my code:</p>
  
  <p>Board.cpp</p>
  
  <pre><code>#include "Board.h"
  #include &lt;string&gt;
  #include &lt;iostream&gt;
  #include "Player.h"
  
  using namespace std;
  
  Board::Board()
  : _board{ { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }
  {
  }
  
  void Board::drawBoard()
  {
      for (int i = 0; i &lt; 4; i++){
          for (int j = 0; j &lt; 4; j++){
              if (i == 0 &amp;&amp; j == 0){
                  cout &lt;&lt; " ";
              }
              else if (i == 0){
                  cout &lt;&lt; " " &lt;&lt; j &lt;&lt; " ";
              }
              else if (j == 0){
                  cout &lt;&lt; i;
              }
              else {
                  if (_board[i][j] == 0)
                      cout &lt;&lt; "| " &lt;&lt; "|";
                  else
                      cout &lt;&lt; "|" &lt;&lt; _board[i][j] &lt;&lt; "|";
              }
          }
          cout &lt;&lt; endl;
      }
  }
  
  void Board::playerInput(char input)
  {
  }
  </code></pre>
  
  <p>here is Board.h:</p>
  
  <pre><code>#pragma once
  #include &lt;string&gt;
  #include &lt;iostream&gt;
  
  class Board
  {
  public:
      Board();
      void drawBoard();
      void playerInput(char input);
  
  
  private:
      char _board[3][3];
      char _input;
  };
  </code></pre>
  
  <p>is that a right way to initialize an array? i read some articles but it just confuses me more.
  i'm sorry if i sound stupid. but i need your help.
  thank you.</p>