C++指向指针的指针

#include iostreamusing namespace std;int main () {intvar;int*ptr;int**pptr;var = 3000;// take the address of var

编程学习网为您整理以下代码实例,主要实现:C++指向指针的指针,希望可以帮到各位朋友。

#include <iostream>

using namespace std;

int main () {
   int  var;
   int  *ptr;
   int  **pptr;

   var = 3000;

   // take the address of var
   ptr = &var;

   // take the address of ptr using address of operator &
   pptr = &ptr;

   // take the value using pptr
   cout << "Value of var :" << var << endl;
   cout << "Value available at *ptr :" << *ptr << endl;
   cout << "Value available at **pptr :" << **pptr << endl;

   return 0;
}
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐