When are variables removed from memory in C++?

前端 未结 11 1160
梦如初夏
梦如初夏 2020-12-16 06:54

I\'ve been using C++ for a bit now. I\'m just never sure how the memory management works, so here it goes:

I\'m first of all unsure how memory is unallocated in a fu

11条回答
  •  时光说笑
    2020-12-16 07:32

    temp is allocated on the stack. So when the function returns, it is gone.

    C++ scope rules are similar to C#.

提交回复
热议问题