C program to pass a one dimensional (1D) array to a function
Given a one dimensional array (an integer array) and we have to pass the array to a function and print the elements using C program.
Here is the function that we have used in the program,
void arrayfun(int*ptr , int count)
Here,
- void is the returns type of the function i.e. this function does not return any value.
- int *ptr is an integer pointer that will store the based address of the integer array which will be passed through the main() function.
- int count is an integer variable that will store the total number of elements which will be passed through the main() function.
Function calling statement,
arrayfun(array,9);
Program to pass a one dimensional array to function in C
Output
need an explanation for this answer? contact us directly to get an explanation for this answer