What is the lifetime of a static variable in a C++ function?

后端 未结 5 1303
渐次进展
渐次进展 2020-11-22 03:32

If a variable is declared as static in a function\'s scope it is only initialized once and retains its value between function calls. What exactly is its lifetim

5条回答
  •  时光取名叫无心
    2020-11-22 04:07

    The Static variables are come into play once the program execution starts and it remain available till the program execution ends.

    The Static variables are created in the Data Segment of the Memory.

提交回复
热议问题