I'm just asking because when I put this in my program...
Code:
void display_array( int array[ ], int size )
{
for ( int i = 0; i < size; i++ )
cout << array[ i ] << endl;
cout << endl;
}
...my instructor said it's wrong. He said it should be...
Code:
void display_array( int *array, int size )
{
for ( int i = 0; i < size; i++ )
cout << array[ i ] << endl;
cout << endl;
}
He told me to use subscript notation, so I thought he would accept array[] instead of *array in the function's parameter. He said that subscript notation only applies inside the definition of the function. So, I've been trying to find a website that backs him.
Though, you should know he's about 70 years old, he always uses void main(), and he still uses <iostream.h>. I'm not sure exactly how he's qualified to teach C++ since he doesn't even have a degree in computer science; he has a degree in business and economics.
Also, Prelude, your whitespace coding style is very helpful for understanding code - a very nice style. I'm just saying that so you don't get any lawyers on me.