title: How to transefer arrays to outside functions?
body: <p>I'm writing a programme in C that is to make some matrix calculations. However I'm having a problem with transferring two arrays(my matrixs) to the outside function which will add them.</p>
  
  <p>Here is my method of creating dynamic matrix: </p>
  
  <pre><code>
          int w1, k1;//lines and columns for matrix1
      int* m1;//a pointer for matrix1
      int w2, k2;//lines and columns for matrix2
      int* m2;//a pointer for matrix2
  
      printf("type the number of lines and columns for matrix1: ");
      scanf("%d %d", &amp;w1, &amp;k1);
      m1 = (int*)malloc(w1 * k1 * sizeof(int));
  
      printf("type the number of lines and columns for matrix1: ");
      scanf("%d %d", &amp;w2, &amp;k2);
      m2 = (int*)malloc(w2 * k2 * sizeof(int));
  
      //fulfillement of both arrays
  
      //matrix1
      int i, j;//for matrix1
      for (i = 0; i &lt; w1; i++)
      {
          for (j = 0; j &lt; k1; j++)
          {
              printf("type the values for cell ( %d,%d ): ", i,j);
              scanf("%d", &amp;m1[i*w1 + j]);
          }
      }
  
      //matrix2
      int m, n;//for matrix2
      for (m = 0; m &lt; w2; m++)
      {
          for (n = 0; n &lt; k2; n++)
          {
              printf("type the values for cell ( %d,%d ): ", m, n);
              scanf("%d", &amp;m2[m * w2 + n]);
          }
      }
  
      sum(&amp;m1, &amp;m2);
  
  
  </code></pre>
  
  <p>Right now I'm trying to transfer both fulfilled arrays to the outside function that will add them. This "sum(&amp;m1,&amp;m2);"... I just don't know how to transfer these arrays to the outside function, and create inside this function an array of the same dimension as given by the user so I can add.</p>