gpt4 book ai didi

c++ - 如何在 C/C++ 中释放数组

转载 作者:太空狗 更新时间:2023-10-29 15:17:35 26 4
gpt4 key购买 nike

<分区>

int main() {
// Will this code cause memory leak?
// Do I need to call the free operator?
// Do I need to call delete?
int arr[3] = {2, 2, 3};
return 0;
}
  1. 这段代码会造成内存泄漏吗?

  2. arr 位于何处?在堆栈上还是在 RAM 中?

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