Programming Code Center(PCC)
[CPP]

(PCC)::[How-to-write-CPP-Program-to-Access-Elements-of-an-Array-Using-Pointer]::[cpp]

File Name : Access_Elements_of_an_Array_Using_Pointer.cpp

//Example: Access Array Elements Using Pointer
#include <iostream>
using namespace std;

int main()
{
   int data[5];
   cout << "Enter elements: ";

   for(int i = 0; i < 5; ++i)
      cin >> data[i];

   cout << "You entered: ";
   for(int i = 0; i < 5; ++i)
      cout << endl << *(data + i);

   return 0;
}

Output :

Access_Elements_of_an_Array_Using_Pointer.jpg