Mega Code Archive

 
Categories / C++ Tutorial / Pointer
 

Demonstrating the Address-of Operator

#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; }