title: #EMERGENCY!!! Run-Time Check Failure #2 - Stack around the variable 'b' was corrupted
body: <p>I know this seems like an old question, but none answered questions I searched work.
  I have kept receiving "Run-Time Check Failure #2 - Stack around the variable 'b' was corrupted." when I was trying to do a [4][2]*[2][3] matrix multiplication. </p>
  
  <p>Does anyone spot the problem?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main() {
      int a[4][2] = {0};
      int b[2][3] = {0};
      int c[3][3] = {0};
      int i, j;
      printf("Please enter first matrix value\n");
      for (i = 0; i &lt; 4; i++) {
          for (j = 0; j &lt; 2; j++) {
              printf("%d row, %d column:", i + 1, j + 1);
              scanf("%d", &amp;a[i][j]);
          }
      }
      printf("Please enter second matrix value\n");
      for (i = 0; i &lt; 2; i++) {
          for (j = 0; j &lt; 3; j++) {
              printf("%d row, %d column:", i + 1, j + 1);
              scanf("%d", &amp;b[i][j]);
          }
      }
      printf("\n the result is :\n");//
      for (i = 0; i &lt; 4; i++) {
          printf("[");
          for (j = 0; j &lt; 3; j++) {
              c[i][j] = (a[i][0] * b[0][j]) + (a[i][1] * b[1][j]);
              printf(" %4d ", c[i][j]);
          }
          printf("]\n");
      }
      return 0;
  }
  </code></pre>