gpt4 book ai didi

c++ - 有没有办法在 C++ 中获取动态分配数组的长度?

转载 作者:行者123 更新时间:2023-11-27 23:28:44 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Is there any way to determine the size of a C++ array programmatically? And if not, why?

我能否在 C++ 中获取动态分配数组的长度,如果不能,C++ 的删除运算符如何知道要释放多少元素。

我搜索了论坛,发现对于动态分配的数组,长度存储在数组头之前的四个字节或其他地方。我怎样才能得到这个值?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com