Demonstrating the Address-of Operator : address of « Pointer « C++ Tutorial






#include <iostream>

int main()
{
   using namespace std;
   unsigned short shortVar=5;
   unsigned long  longVar=65535;
   long sVar = -65535;

   cout << shortVar;
   cout << "Address of shortVar:" << endl;
   cout <<  &shortVar  << endl;

   cout << longVar;
   cout << "Address of longVar:" << endl;
   cout <<  &longVar  << endl;

   cout << sVar;
   cout << "Address of sVar:" << endl;
   cout <<  &sVar << endl;

   return 0;
}








11.4.address of
11.4.1.Address of operator and addresses of local variables
11.4.2.Demonstrating the Address-of Operator
11.4.3.Printing the address stored in a char* variable