Array name is the pointer to the array - C++ Data Type

C++ examples for Data Type:Array Pointer

Description

Array name is the pointer to the array

Demo Code

#include <iostream>
using namespace std;
int main()// w  ww.ja va2  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;
}

Result


Related Tutorials