fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7. int* a = new int[2];
  8. a[0] = 12;
  9. a[1] = 5;
  10. int *b = &a[1];
  11. std::cout << a << "," << &a[0] << ", "<< &a << ", "
  12. << *a << ", " << a[0] << ", "<< a[1] << ", " << b << ", " << &a[1]
  13. << std::endl;
  14. delete[] a;
  15. std::cout << *b << a[1] << a[0];
  16. return 0;
  17. }
Success #stdin #stdout 0.01s 2856KB
stdin
Standard input is empty
stdout
0x82a2008,0x82a2008, 0xbfc0dea4, 12, 12, 5, 0x82a200c, 0x82a200c
550