You should only use arrays in c++ if you REALLY have to, in any other case use stuff like vector, list etc.
But I'll try to explain the function anyway:
Code:
void printArray ( int arg[], int length )
{
for( int i = 0; i < length; ++i )
{
cout << arg[i] << "\n";
}
}
int main ( void )
{
int test[5] = { 0, 1, 2, 3, 4 };
printArray ( test, sizeof test / sizeof *test );
}
An array is basically a box with seperate compartments. When adding something to an array, a new compartment is made and it is identified by a number(starting at 0, not 1). You can fill the array like I did on line 1 in the main function.
Any compartment can be accessed by typing 'test[ <number of compartment> ]' so all the for loop does is:
access compartment 0 and print it
access compartment 1 and print it
And it continues this untill it reaches the end of the array(c++ doesn't know the end of the array so you need to pass this to the function).
I hope it makes sense now, the printArray doesn't change anything to the array all it does is look at it and print each element that you have added.
In any case, look up vectors and other c++ containers and use them instead
