fork download
  1. #include <iostream>
  2.  
  3. void fun1(int ** i) {
  4. *i = new int(0);
  5. }
  6. void fun2(int *& i) {
  7. i = new int(69);
  8. }
  9. int main()
  10. {
  11. using namespace std;
  12. int* a = new int(42);
  13. cout << "init: " << *a << endl;
  14.  
  15. fun1(&a);
  16. cout << "fun1: " << *a << endl;
  17.  
  18. fun2(a);
  19. cout << "fun2: " << *a << endl;
  20.  
  21. return 0;
  22. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
init: 42
fun1: 0
fun2: 69