fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void take_pointer(int* pointer)
  5. {
  6. cout<<"address = "<<pointer<<endl;
  7. pointer = new int(10);
  8. cout<<"address = "<<pointer;
  9. }
  10.  
  11. int main()
  12. {
  13. int* stack_pointer;
  14. int stack_int = 10;
  15. stack_pointer = &stack_int;
  16. cout<<"First value = "<<stack_pointer<<endl;
  17. take_pointer(stack_pointer);
  18.  
  19. cout<<endl<<"Value after subporgram = "<<stack_pointer<<endl;
  20. getchar();
  21.  
  22. return 0;
  23. }
Success #stdin #stdout 0s 3432KB
stdin
Standard input is empty
stdout
First value = 0xbffd617c
address = 0xbffd617c
address = 0x883a008
Value after subporgram = 0xbffd617c