title: Why doesn't my function really initialize the array?
body: <p>I'm trying to write a function that initializes an array to zero:</p>
  
  <pre><code>void InitializingToZero(int numOfrows, int numOfcols, int array[][20]) {
      for (int i = 0; i &lt; numOfrows; i++) {
          for (int j = 0; j &lt; numOfcols; j++) {
              array[i][j] = 0;
          }
      }
  }
  
  int main() {
      int num_of_rows = 3;    
      int num_of_cols = 3;
  
      int array[num_of_rows][num_of_cols];
  
      InitializingToZero(num_of_rows, num_of_cols, array);
  
      for (int i = 0; i &lt; num_of_rows; i++) {
          for (int j = 0; j &lt; num_of_cols; j++) {
              printf("%d ", array[i][j]);
          }
          printf("\n");
      }
  }
  </code></pre>
  
  <p>And I get this output:  </p>
  
  <blockquote>
    <p>0 0 0<br>
    0 0 0<br>
    268501009 0 4200656 </p>
  </blockquote>