Can I access static variables inside a function from outside

后端 未结 8 1385
夕颜
夕颜 2021-01-02 04:15

C/C++: Can I access static variables inside a function from outside? For example:

#include 
using namespace std;

void f()
{
    static int c         


        
8条回答
  •  渐次进展
    2021-01-02 04:42

    Variables inside a function scope cannot be accessed externally by name, but you can return a pointer or reference to it

提交回复
热议问题