On 16/08/2017 8:14 AM, Suliman wrote:
On Wednesday, 16 August 2017 at 07:09:02 UTC, rikki cattermole wrote:
On 16/08/2017 8:06 AM, Suliman wrote:
If structures placing data on the stack why we do not getting
stackoveflow while we creating array of structures? Or for example
big structure.
Am I right understand that structures placing data _only_ on stack?
But the stack size is very limited (on Widnows it's just 1MB).
So how it's work?
Struct's by themselves go on the stack.
If they are allocated via new/malloc its on the heap (and hence are
pointers).
Same situation with arrays or inside a class.
But for example if I am getting array of structs and getting data to it,
where it's locating?
On the heap, unless you are allocating it via e.g. alloca.