mirror of
https://github.com/krahets/hello-algo.git
synced 2025-12-19 07:17:54 +08:00
Add destructors to the C++ codes.
This commit is contained in:
@@ -245,6 +245,8 @@ elementAddr = firtstElementAddr + elementLength * elementIndex
|
||||
for (int i = 0; i < size; i++) {
|
||||
res[i] = nums[i];
|
||||
}
|
||||
// 释放内存
|
||||
delete[] nums;
|
||||
// 返回扩展后的新数组
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user