Accessing array elements using pointers
we can access the array elements using pointers.
ptr is an integer pointer which holds the address of the first element. i.e &arr
ptr + 1 points the address of second variable. i.e &arr
Similarly, ptr + 2 holds the address of the third element of the array. i.e. &arr
Printing each array elements address and value
Modifying array elements using the pointer
Let's change the 3rd (index 2) element as 1000.