How are arrays created and accessed

后端 未结 4 1678
醉话见心
醉话见心 2020-12-12 03:14

I understand(not completely why, though) that instances of primitive types such as int, float are stored on the stack and are not heap allocated. But I am a bit confused abo

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-12 03:51

    Array itself is always a reference type, so it's stored on heap. Elements of an array are stored on heap too, but always in a contiguous block of memory.

提交回复
热议问题