fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7. int a = 2;
  8.  
  9. int *ptr1 = &a;
  10. void *ptr2 = &ptr1;
  11.  
  12. std::cout << **(int**)ptr2 << std::endl;
  13. int b = 3;
  14. ptr1 = &b;
  15. std::cout << **(int**)ptr2 << std::endl;
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0s 4712KB
stdin
Standard input is empty
stdout
2
3