1#include<iostream>
2int main()
3{
4 // three ways to enter the values of arrays
5 int array[] {1,2,3};
6
7 // Array subscript notation
8 std::cout<<array[0]<<std::endl;// 1
9 std::cout<<array[1]<<std::endl;// 2
10 std::cout<<array[2]<<std::endl;// 3
11
12 // Pointer subscript notation
13 int *array_ptr ={array};
14 std::cout<<array_ptr[0]<<std::endl;//1
15 std::cout<<array_ptr[1]<<std::endl;//2
16 std::cout<<array_ptr[2]<<std::endl;//3
17
18 //Array offset notation
19
20 std::cout<<*array<<std::endl;//1
21 std::cout<<*(array+1)<<std::endl;//2
22 std::cout<<*(array+2)<<std::endl;//3
23
24 //Pointer offset notation
25 std::cout<<*array_ptr<<std::endl;//1
26 std::cout<<*(array_ptr+1)<<std::endl;//2
27 std::cout<<*(array_ptr+2)<<std::endl;//3
28
29
30 return 0;
31
32}