fork download
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. int * heap_(new int(0));
  6. int stack_(0);
  7. void * esp_(nullptr);
  8.  
  9. asm("mov %%esp, %0" : "=m" (esp_));
  10.  
  11. std::cout << "heap address\t: " << heap_
  12. << "\nstack address\t: " << &stack_
  13. << "\nstack pointer\t: " << esp_ << std::endl;
  14.  
  15. delete (heap_);
  16.  
  17. return (0);
  18. }
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
heap address	: 0x81aa008
stack address	: 0xbf9a3ae8
stack pointer	: 0xbf9a3ad0