fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void foo(int *ptr){
  5. cout << &ptr << endl;
  6. cout << ptr << endl;
  7. cout << *ptr << endl;
  8. }
  9.  
  10. void foo2(int &ref){
  11. cout << &ref << endl;
  12. cout << ref << endl;
  13. }
  14.  
  15. int main() {
  16. int i = 10;
  17. cout << &i << endl;
  18. foo(&i);
  19. foo2(i);
  20.  
  21. return 0;
  22. }
Success #stdin #stdout 0.01s 5456KB
stdin
Standard input is empty
stdout
0x7ffe455ee414
0x7ffe455ee3e8
0x7ffe455ee414
10
0x7ffe455ee414
10