Arrays and Pointers.

would it be possible to use pointer notation, *array or *(array + i), within the body of the function if the header uses array notation, int array[]? if so, Explain.


1
2
3
4
5
6
7
void displayArray(int *array, int size)
{
   cout << "Array values:  \n";
   for (int i=0; i < size; i++,array++) // "moves" the pointer
      cout << *array << endl;
   cout << endl;
}
Yes, it's possible.
Topic archived. No new replies allowed.