C++ Array name is the pointer to the array

Description

C++ Array name is the pointer to the array

#include <iostream>
using namespace std;
int main()//w  ww.ja v a 2 s .  c  o m
{
   const int NUMELS = 20;
   int arr[NUMELS];
   cout << "The starting address of the arr array is: " << int (&arr[0]) << endl;
   cout << "The storage size of each array element is: " << sizeof(int) << endl;
   cout << "The address of element number 5 is: " << int (&arr[5]) << endl;
   cout << "The starting address of the array, " << "\ndisplayed using the notation arr, is: " << int (arr) << endl;
   return 0;
}



PreviousNext

Related