下面的程序是能编译通过的:
这样做算是 UB 之类的吗?
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
struct modint{
int x;
modint(int o=0){x=o;}
modint &operator = (int o){return x=o,*this;}
};
modint res=1;
signed main()
{
printf("%d\n",res);
return 0;
}
来源:这里看到可以直接输出结构体