Finding size of dynamically allocated array

前端 未结 7 594
礼貌的吻别
礼貌的吻别 2020-12-10 11:08

Why is it not possible to get the length of a buffer allocated in this fashion.

AType * pArr = new AType[nVariable];

When the same array is

相关标签:
7条回答
  • 2020-12-10 11:46

    No, not really. At least not in a platform-independent, defined way.

    Most implementations store the size of a dynamically allocated array before the actual array though.

    0 讨论(0)
提交回复
热议问题