Passing an Array to a Function




This video tutorial explains how to pass an array to a function in c++.
You will learn how the array elements can be accessed in a function in detail with examples.

source code for this tutorial

#include <iostream>

using namespace std;

void show(int [],int);

int main()
{
    int numbers[] = {25,44,66,96,754};
    int length = 5;

    show(numbers,length);
    return 0;
}

void show(int numbers[],int length){
for(int counter = 0; counter < length; counter++){
cout << numbers[counter]<<endl;
}
}

 
Back To Top