#include <iostream>
int main()
{
unsigned short int intValue = 5, yourAge = 10;
unsigned short int * intPointer = &intValue; // a pointer
std::cout << "intValue:\t" << intValue;
std::cout << "\t\tyourAge:\t" << yourAge << "\n";
std::cout << "&intValue:\t" << &intValue;
std::cout << "\t&yourAge:\t" << &yourAge <<"\n";
std::cout << "intPointer:\t" << intPointer << "\n";
std::cout << "*intPointer:\t" << *intPointer << "\n\n";
intPointer = &yourAge; // reassign the pointer
std::cout << "intValue:\t" << intValue;
std::cout << "\t\tyourAge:\t" << yourAge << "\n";
std::cout << "&intValue:\t" << &intValue;
std::cout << "\t&yourAge:\t" << &yourAge <<"\n";
std::cout << "intPointer:\t" << intPointer << "\n";
std::cout << "*intPointer:\t" << *intPointer << "\n\n";
std::cout << "&intPointer:\t" << &intPointer << "\n";
return 0;
}
|