title: matrix addition using pointers in C
body: <p>Write a program to add 2 m*n matrices using just pointer referencing/dereferencing. That is, no array use allowed. 
  my code is as:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int main()
  {
      int row,col;
      scanf("%d %d",&amp;row,&amp;col);
      int* ptr1;
      int* ptr2 = ptr1 + (row*col);/*if ptr1+(row*col) is not there then runtime error is given*/
      int* ptr3 = ptr2 + (row*col);
      for(int i=1;i&lt;=(row*col);i++)
      {
          scanf("%d",(ptr1+i));
      }
      for(int i=1;i&lt;=(row*col);i++)
      {
          scanf("%d",(ptr2+i));
          *(ptr3+i)=(*(ptr1+i) + *(ptr2+i));
      }
      for(int i=1;i&lt;=(row*col);i++)
      {
          printf("%d ",(*(ptr3+i)));
          if(i%col == 0) printf("\n");
      }
      return 0;
  }
  </code></pre>
  
  <p>problem is that it works fine for upto 3*3 matrices and after that it gives runtime error.</p>