Explanation:-
address of array element in c++, we have to print the address of an array(an array each variable of an array) or we have to display the memory location of each element of an array we can do this by adding "address of" or "&" operator. Ths "&" operator returns the address of a variable in a memory location. or we can do this by using a pointer for that we have to transfer all array elements to pointer one by one and print the pointer value as we know that pointer is a variable that holds the address of another variable so each time in a Loop we assign the array value to a pointer and print the value of hold by pointer.
Output:
=======================================
Enter The Size of The Array
=======================================
4
=======================================
Enter The Elements Of An array
=======================================
5
6
7
8
=======================================
Displaying An Address Using An Arrays
=======================================
Address Of 5 Using Array is ===> 0x7fffd281ea30
Address Of 6 Using Array is ===> 0x7fffd281ea34
Address Of 7 Using Array is ===> 0x7fffd281ea38
Address Of 8 Using Array is ===> 0x7fffd281ea3c
=======================================
Displaying An Address Using Pointers
=======================================
Address Of 5 Using Pointers is ===> 0x7fffd281ea30
Address Of 6 Using Pointers is ===> 0x7fffd281ea34
Address Of 7 Using Pointers is ===> 0x7fffd281ea38
Address Of 8 Using Pointers is ===> 0x7fffd281ea3c
========================================
need an explanation for this answer? contact us directly to get an explanation for this answer