阅读背景:

在C中返回堆栈数据;它是否正确无法分配?

来源:互联网 

I was reviewing a friend's code and got into an interesting debate on how C/C++ allocates memory on the stack and manages its release. If I were to create an array of 10 objects in a function, but return said array, does it release when the function pops (hence making the given data invalid) or is it placed into the heap (which raises the question of how do we release it?).I was reviewing a friend's code and got into an




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: