pointerincrement2.cpp

来自「Think in C++ 2nd」· C++ 代码 · 共 28 行

CPP
28
字号
//: C03:PointerIncrement2.cpp

// From Thinking in C++, 2nd Edition

// Available at http://www.BruceEckel.com

// (c) Bruce Eckel 1999

// Copyright notice in Copyright.txt

#include <iostream>

using namespace std;



typedef struct {

  char c;

  short s;

  int i;

  long l;

  float f;

  double d;

  long double ld;

} Primitives;



int main() {

  Primitives p[10];

  Primitives* pp = p;

  cout << "sizeof(Primitives) = " 

    << sizeof(Primitives) << endl;

  cout << "pp = " << (long)pp << endl;

  pp++;

  cout << "pp = " << (long)pp << endl;

} ///:~

⌨️ 快捷键说明

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