If structures places data to stack why we do not getting stackoverflow on array of structures?
rikki cattermole via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Aug 16 00:09:02 PDT 2017
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.
More information about the Digitalmars-d-learn
mailing list