fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct Block {
  5. int number;
  6. };
  7.  
  8. int main() {
  9.  
  10. static Block static_block;
  11. cout << "static_block: " << &static_block << endl;
  12.  
  13. Block stack_block;
  14. cout << "stack_block: " << &stack_block << endl;
  15.  
  16. Block* heap_block = new Block();
  17. cout << "heap_block: " << heap_block << endl;
  18. delete heap_block;
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 3272KB
stdin
Standard input is empty
stdout
static_block: 0x8049bd0
stack_block: 0xbf864e1c
heap_block: 0x9c9f008