开发者

Static variable memory destruction

A static variable is defined in a func开发者_运维知识库tion.Can v destroy its memory outside that function?


If you're talking about C, then no you can't "destroy its memory" - all your static variables are going to be around for as long as your program is running.


What do you mean by "destroy its memory"?

If you mean 'free' the memory, the answer is no.

If you mean overwrite it, the answer is yes (a pointer to the variable can be given to something outside the function that 'owns' it, or a common bug could trash the memory).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜