C# Passing array to function

tutorial and example
tutorial and example

We can pass array to function by using its name only. The formal parameter in function declaration must be of array type. Function accepts arrays to implement any logic on them which can be reused. Let’s see an example of passing array to the function.

Output

Passing Array to function: finding second largest element of array

Output

Passing Array to function Example: sorting the array using bubble sort

Output

Passing Array to function: printing sum and average of all elements

Output