title: How can I pass a pointer of a [5][5] array to a function that requires a double-pointer of the same array?
body: <p>I'm making a program that can calculate a square matrix multiplied by its own elements several times, and can print the elements.</p>
  
  <p>In order to do so, I want to give a pointer of a array to a function that requires a double-pointer, but the array that I want to fill in the calculated elements becomes a NULL, so I'm at a loss.</p>
  
  <p>I've tried to understand how the pointers work, and changed the array into an pointer of an array, or pointer to a pointer to an array, but I couldn't understand how it works.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  #define row 5
  #define col 5
  #define max 5
  void input_matrix(float [][col], int n);
  void output_matrix(float [][col], int n);
  void multiply_matrix(float [][col], float [][col], float [][col], int n);
  void power_matrix(float (**)[max],float [][col], int n, int k);
  float A[row][col];
  float B[row][col];
  float ak[row][col];
  int i, j, k, l, n;
  
  int main() {
      printf("What order square matrix do you want?\n");
      scanf("%d", &amp;n);
      scanf("%d", &amp;k);
  
      if(n &gt; max) {
          fprintf(stderr, "Make it less than 5 digits.\n");
          return -1;
      }
  
      input_matrix(A, n);
      power_matrix(ak, A, n, k);
      output_matrix(A, n);
  
      return 0;
  }
  
  void input_matrix(float a[][col], int n) {
      for(i = 0; i &lt; n; i++) {
          for(j = 0; j &lt; n; j++) {
              printf("Enter the element of row %d column %d.\n", i+1, j+1);
              scanf("%f", &amp;a[i][j]);
          }
      }
  }
  
  void output_matrix(float a[][col], int n) {
      for(i = 0; i &lt; n; i++) {
          for(j = 0; j &lt; n; j++) {
              printf("%f ", a[i][j]);printf("\n");
          }
      }
  }
  
  void multiply_matrix(float ak[][col], float a[][col], float b[][col], int n){
  for(i=0;i&lt;n;i++){
      for(j=0;j&lt;n;j++){
          for(l=0;l&lt;n;l++){
              ak[i][j]+=a[i][l] * b[l][j];
          }
      }
  }
  
  }
  
  void power_matrix(float (**ak)[col],float a[][col], int n, int k){
  float (*x)[max], (*y)[max];
  switch(k){
      case 1:
          *ak=a;
          break;
  
      case 2:
          multiply_matrix(*ak, a, a, n);
          break;
  
      default:
          multiply_matrix(*ak, a, a, n);
          for(i=3;i&lt;=k;i++){
              x=*ak;
              y=B;
              multiply_matrix(y, a, x, n);
              *ak=y;
          }
  }
  }
  </code></pre>
  
  <p>I expect the output to be like,</p>
  
  <pre><code>4.000000
  4.000000
  4.000000
  4.000000
  </code></pre>
  
  <p>when the input is,</p>
  
  <pre><code>2 2
  1
  1
  1
  1
  </code></pre>