C program to pass two dimensional array (Two-D array) to a function
Given a two dimensional array and we have to pass it to the function in C.
In this example, we are declaring a two dimensional array inside the main() function and passing it to the function - within the function, elements of the array are printing.
Here is the function that we are using in the program,
void arrayfun(int ptr , int row, int col)
- void is the return type of the function.
- arrayfun is the name of the function.
- int ptr an integer type of variable (which is declared as two dimensional array), that will store the elements of the array which will be passed. We can also use int ptr there is no need to provide size for the row, but number of maximum columns must be provided.
- int row, int col are the variables that will store the value of number of rows and columns.
Function calling statement,