135
C++ Passing Array to Function
In C++, to reuse the array logic, we can create function. To pass array to function in C++, we need to provide only array name.
C++ Passing Array to Function Example: print array elements
Let’s see an example of C++ function which prints the array elements.
Output:
Printing array elements: 10 20 30 40 50 Printing array elements: 5 15 25 35 45
C++ Passing Array to Function Example: Print minimum number
Let’s see an example of C++ array which prints minimum number in an array using function.
Output:
Minimum element is: 10 Minimum element is: 5
C++ Passing Array to Function Example: Print maximum number
Let’s see an example of C++ array which prints maximum number in an array using function.
Output:
Maximum element is: 54 Maximum element is: 67
Next TopicC++ Multidimensional Arrays