Access Array Elements Using Pointers
Output
Enter elements: 1 2 3 5 4 You entered: 1 2 3 5 4
In this program, the elements are stored in the integer array data[].
Then, the elements of the array are accessed using the pointer notation. By the way,
data[0]is equivalent to*dataand&data[0]is equivalent todatadata[1]is equivalent to*(data + 1)and&data[1]is equivalent todata + 1data[2]is equivalent to*(data + 2)and&data[2]is equivalent todata + 2...data[i]is equivalent to*(data + i)and&data[i]is equivalent todata + i
Visit this page to learn about the relationship between pointers and arrays.