C++ Pointer Access next array element by add one to array pointer, *(arrayName + i)

Description

C++ Pointer Access next array element by add one to array pointer, *(arrayName + i)

#include <iostream>
using namespace std;
int main()/*from  w w  w .  ja va  2  s .c  om*/
{
   const int ARRAYSIZE = 5;
   int i, grade[ARRAYSIZE] = {98, 87, 92, 79, 85};
   for (i = 0; i < ARRAYSIZE; i++)
      cout << "\nElement " << i << " is " << *(grade + i);
   cout << endl;
   return 0;
}



PreviousNext

Related