C++ pointer to array elements

Objectives :

  • myPtrtArrayElement1.cpp
    int *ptr1; int array[4]={2,4,6,8};
    ptr1 = array
    // now index of this ptr1 will display the data [ index] stored in the memory
  • code:myPtrtArrayElement1.txt

Step: 1 Create a source file.

Step: 2 Edit and save Source file

 

Step: 3 Runtime Views:

Step: