为什么这里的输出是30?fun()=30 如何有效?给函数赋值是什么意思?为什么删除静态关键字会引发分段错误?
#include<iostream>
using namespace std;
int &fun()
{
static int x = 10;
return x;
}
int main()
{
fun() = 30;
cout << fun();
return 0;
}
Run Code Online (Sandbox Code Playgroud) c++ ×1