title: How to initialize a two-dimentional array with declaration of variables, (why doesn't this work arr[x][y] = {0} )?
body: <p>why does my array not all have O value?</p>
  <p>// this is my code</p>
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  
  int main(){
      int x = 5;
      int y = 7;
      int arr[x][y] = {0};
      for(int i = 0; i &lt; x; i++){
          for(int j = 0; j &lt; y; j++){
              cout &lt;&lt; arr[i][j] &lt;&lt; &quot; &quot;;
          }
          cout &lt;&lt; endl;
      }
      return 0;
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/E2SPR.png" rel="nofollow noreferrer">Image of my result</a></p>