list0801.cpp

来自「teach yourself C++ in 21 days 第五版」· C++ 代码 · 共 26 行

CPP
26
字号
// Listing 8.1 Demonstrates address of operator
// and addresses of local variables
#include <iostream>

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

   cout << "shortVar:\t" << shortVar;
   cout << "\tAddress of shortVar:\t";
   cout <<  &shortVar  << endl;

   cout << "longVar:\t"  << longVar;
   cout  << "\tAddress of longVar:\t" ;
   cout <<  &longVar  << endl;

   cout << "sVar:\t\t"     << sVar;
   cout << "\tAddress of sVar:\t" ;
   cout <<  &sVar     << endl;

   return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?