title: passing a 3D pointer array to a function
body: <p>so i'm having problems making this test program work. so my goal is to make and initialize a 3D array in my main function, then create a pointer to that array. afterwards i'm trying to pass the pointer to a function and then print out the elements in the array so that i can see it works. my problem arises when trying to pass the pointer array tho. Can any of you guys see were im going wrong?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  //declare test function
  void test (int*);
  
  int main(){
  
      //declare array and pointer
      int array[2][3][2];
      int (*p)[2][3][2] = &amp;array;
  
      int i,j,k;
  
      //initialize array
      for(i = 0; i &lt; 2; i++){
          for(j = 0; j &lt; 3; j++){
              for(k = 0; k &lt; 2; k++){
                  array[i][j][k] = 0;
              }       
          }
      }
  
      //print array
      for(i = 0; i &lt; 2; i++){
          for(j = 0; j &lt; 3; j++){
              for(k = 0; k &lt; 2; k++){
                  printf("%d\n", array[i][j][k]);
              }       
          }
      }
      printf("----------------------------\n\n");
      //pass pointer array into test function
      test(p);    
  }
  
  
  void test(int (*array2)[2][3][2]){
      int i, j, k;
      //run thru each element in the pointer array and print
      for(i = 0; i &lt; 2; i++){
          for(j = 0; j &lt; 3; j++){
              for(k = 0; k &lt; 2; k++){
                  printf("%d\n", array2[i][j][k]);
              }       
          }
      }           
  }
  </code></pre>