C/C++编程语言中的指针(pointer)你了解吗

  #include

  using namespace std;

  int main()

  {

  char c = 'A';

  cout << "c is: " << c << endl;

  cout << "address of c is: " << (void*)&c << endl << endl;

  char* pChar1 = &c;

  cout << "*pChar1 is: " << *pChar1 << endl;

  cout << "pChar1 is: " << (void*)pChar1 << endl;

  cout << "address of pChar1 is: " << &pChar1 << endl << endl;

  char* pChar2 = pChar1;

  cout << "*pChar2 is: " << *pChar2 << endl;

  cout << "pChar2 is: " << (void*)pChar2 << endl;

  cout << "address of pChar2 is: " << &pChar2 << endl << endl;

  char** pChar3 = &pChar2;

  cout << "**pChar3 is: " << **pChar3 << endl;

  cout << "*pChar3 is: " << (void*)(*pChar3) << endl;

  cout << "pChar3 is: " << (void*)pChar3 << endl;

  cout << "address of pChar3 is: " << &pChar3 << endl << endl;

  return 0;

  }