C++PrimerPlus第二单元源码.docVIP

  • 1
  • 0
  • 约8.54千字
  • 约 8页
  • 2016-08-02 发布于重庆
  • 举报
CPrimerPlus第二单元源码

//compounddecls.cpp #include iostream int main() { // i is an int; p is a pointer to int; r is a reference to int int i = 1024, *p = i, r = i; // three ways to print the value of i std::cout i *p r std::endl; int j = 42, *p2 = j; int *pref = p2; // pref is a reference to the pointer p2 // prints the value of j, which is the int to which p2 points std::cout *pref std::endl; // pref refers to a pointer; assigning i to pref makes p point to i pref = i; std::cout *pref std::endl; // prints the value of i // dereferencing pref yields i, the int to which p2 po

文档评论(0)

1亿VIP精品文档

相关文档