Will C reuse the memory of a local block var once it goes out of scope?

后端 未结 4 795
执笔经年
执笔经年 2021-01-21 21:01

(I believe this question is technically distinct from Can a local variable's memory be accessed outside its scope? because it is C instead of C++.)

I know that in C

4条回答
  •  执笔经年
    2021-01-21 21:27

    It's undefined behavior. It may work on some architectures or operating systems, but don't count on it. An example of where it may work is Linux, with the red zone enabled.

提交回复
热议问题