C++ examples for Operator:Address Operator
Get variable address with the address-of operator &,
#include <iostream> int main() /*from www . j av a 2 s . c o m*/ { unsigned short shortVar = 5; unsigned long longVar = 65535; long sVar = -65535; std::cout << "shortVar:\t" << shortVar; std::cout << "\tAddress of shortVar:\t" << &shortVar << "\n"; std::cout << "longVar:\t" << longVar; std::cout << "\tAddress of longVar:\t" << &longVar << "\n"; std::cout << "sVar:\t\t" << sVar; std::cout << "\tAddress of sVar:\t" << &sVar << "\n"; return 0; }