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

后端 未结 4 800
执笔经年
执笔经年 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:26

    The C99, 6.2.4 p2 standard says:

    If an object is referred to outside of its lifetime, the behavior is undefined. The value of a pointer becomes indeterminate when the object it points to reaches the end of its lifetime.

提交回复
热议问题