High Address Preference in Stack

Is it true that structures are stored in stack starting from the highest hexadecimal address and in descending order? If yes, is there a good reason?
The reason is to give the maximum amount of space between the stack and the heap so that they don't run into each other. The stack grows downwards and the heap grows upwards. (Presumably it could've been the other way around.) The overall memory layout of a program is something like:

High:  stack (growing downwards)
         |
         ▼


         ▲
         |
Mid:   heap (growing upwards)
Low:   globals (unitialized (zeroed))
       globals (initialized)
       program text

Thanks dutch. Neat response! It makes sense that the "heap" grows upwards because in real life, heaps do pile "up" :-) And that's a good mnemonic now, so I know stack grows the opposite direction.
Last edited on
Topic archived. No new replies allowed.