// C program to pass a 3D array to a function #include <stdio.h> // Function to print the elements of a 3D array void printArray(int arr[][3][3], int rows, int cols, int depth) { printf("Elements of the 3D array:\n"); // Loop through each element in the 3D array for (int i = 0; i < rows; ++i) { for (int j = 0; j < cols; ++j) { for (int k = 0; k < depth; ++k) { // Print each element printf("%d ", arr[i][j][k]); } // Printing a new line at the end of each column printf("\n"); } // Printing a new line at the end of each row printf("\n"); } } int main() { // Initialize the 3D array with fixed sizes int arr[3][3][3] = { { { 10, 20, 30 }, { 40, 50, 60 }, { 70, 80, 90 } }, { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }, { { 190, 200, 210 }, { 220, 230, 240 }, { 250, 260, 270 } } }; // Declare the dimensions of the array int rows = 3; int cols = 3; int depth = 3; // Pass the 3D array to the function printArray(arr, rows, cols, depth); return 0; // Return 0 to indicate successful execution }