C++ Programming Code Examples C++ > Pointers Code Examples C++ Program to Access Elements of an Array Using Pointer C++ Program to Access Elements of an Array Using Pointer This program declares the array of five element and the elements of that array are accessed using pointer. In this program, the five elements are entered by the user and stored in the integer array data. Then, the data array is accessed using a for loop and each element in the array is printed onto the screen. #include <iostream> using namespace std; int main() { int data[5]; cout << "Enter elements: "; for(int j = 0; j < 5; ++j) cin >> data[j]; cout << "You entered: "; for(int j = 0; j < 5; ++j) cout << endl << *(data + j); return 0; }