title: How to return a 3D array of integers from a function to be used in another function in C?
body: <p>I made this function to split any matrix into smaller-in-dimension ones, it will be used in another function which in its turn will continue doing calculations on the "container" array via using a for loop (cycling through it)
  I need to know how to return the "container" array correctly to be used in another function (not in the main function), taking into account the the parameter in this function comes from another function.
  So this function will receive an array from another function then split it and pack it in a 3D array then return it to be used in the function the parameter that came from</p>
  
  <pre><code>int split_matrix(int matrix[][COL3]){
  int row2, col2, row3, col3, row1, col1 , row , col , x , unwanted_col;
  int container[COL3][COL3-1][COL3-1];
  for (x =0, unwanted_col = 0 ; x &lt; COL3 ; x++ , unwanted_col++){
      for (row2 = 0 , row3=0; row3 &lt; COL3 ; row3++ ){
           for (col2=0, col3 =0; col3 &lt; COL3; col3++){
               if (row3!=0 &amp;&amp; col3 !=unwanted_col){
                  container[x][row2][col2]= matrix[row3][col3] ;
                       col2++;
                            if (col2 == (COL3-1)){row2++;}
                }
            }
         }
  }
  return ?? ;}
  </code></pre>
  
  <p>The container 3D array will be used in this function
  this function will receive a 2D array from the user input (the main function) as a parameter, then will pass this array to the above function and after that use the return value from the above function (container 3D array in this case) and continue working on it, how can I extract the all the elements from the (container 3D array) in the above function and use them here.</p>
  
  <pre><code>void function_name(int matrix[][COL3]){
  // for loop goes here to cycle through the return array and print every single element in the matrix return from the first function
  </code></pre>
  
  <p>how can I do a correct return and how can I use it in the second function?</p>