+-------------------------------------+
| Program Code |
+-------------------------------------+
| Heap | Grown downwards
+-------------------------------------+ vvvvvvvvvvvvvvv
| ^ |
| | |
| | |
| | |
| | |
| | |
| Free Space |
| | |
| | |
| | |
| | |
| v |
+-------------------------------------+ ^^^^^^^^^^^^^
| Stack | Grows upwards
+-------------------------------------+
The output of the program is
location of code: 0x400517
location of heap: 0x19fd420
location of stack: 0x7ffdb3390134
Which is consistent with the order of these locations as depicted in the diagram