fork download
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. int i = 1234;
  6. int* a;
  7. int** b;
  8.  
  9. std::cout << "i is " << i << ", it's address is " << i << "\n";
  10.  
  11. a = &i;
  12.  
  13. std::cout << "a = " << a << ", *a = " << *a << ", its address is " << &a << "\n";
  14.  
  15. b = &a;
  16. std::cout << "b = " << b << ", *b = " << *b << ", **b = " << **b << ", its address is " << &b << "\n";
  17. }
  18.  
Success #stdin #stdout 0s 3096KB
stdin
Standard input is empty
stdout
i is 1234, it's address is 1234
a = 0xbfec6c14, *a = 1234, its address is 0xbfec6c18
b = 0xbfec6c18, *b = 0xbfec6c14, **b = 1234, its address is 0xbfec6c1c