title: How to sum 2D arrays in C/C++
body: <p>I am unable to add two 2D array in c
  what could be the issue ? I am trying to add two multi-dimensional array from user input but the output is not right. 
  Below is my code</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;conio.h&gt;
  void main()
  {
       int m,n,p,q,c,d,k;
       int first[10][10],second[10][10],sum[10][10];
       clrscr();
       printf("\nEnter the number of rows and columns of the first matrix");
       scanf("%d %d",&amp;m,&amp;n);
       printf("\nEnter the elements of the first matrix");
       for (c = 0;c &lt; m;c++)
           for (d = 0;d &lt; n;d++)
               scanf("%d",&amp;first[c][d]);
       printf("\nEnter the number of rows and columns of the second matrix");
       scanf("%d %d",&amp;p,&amp;q);
       printf("\nEnter the elements of the second matrix");
       for (c = 0;c &lt; p;c++)
           for (d = 0;d &lt; p;d++)
               scanf("%d",&amp;second[c][d]);
       for (c = 0;c &lt; m;c++)
           for (d = 0;d &lt; n;d++)
               for (k = 0;k &lt; p;k++)
               {
                    sum[c][d] = first[c][k] + second[k][d];
               }
       printf("\nThe sum of the two matrices is : \n\n");
       for (c = 0;c &lt; m;c++)
           for (d = 0;d &lt; n;d++)
           {
                printf("%d",&amp;sum[c][d]);
                if (d == n-1)
                {
                    printf("\n\n");
                }
           }
       getch();
  }
  </code></pre>