Pass Array to Functions in C Example 1

Like any other variable, you can pass the individual array elements to the function argument.

In this Pass Array to Functions in C program, we created a function that accepts an integer variable and prints that variable as the output. Within the main program, we used for loop to iterate the array and pass each array element to the function that we created earlier.

Pass Array to Functions in C Example 3

Instead of passing an array element, you can pass the reference of it. I mean, array call by reference directly. Please refer C Program to print Array Elements article to understand the logic behind this program.