看看我的示例代码
struct A
{
int member;
};
int main()
{
int A; //Line 1
A b; //Line 2
b.member = int(); //Line 3
}
Run Code Online (Sandbox Code Playgroud)
错误是
prog.cpp: In function ‘int main()’:
prog.cpp:9: error: expected `;' before ‘b’
prog.cpp:9: warning: statement has no effect
prog.cpp:10: error: ‘b’ was not declared in this scope
Run Code Online (Sandbox Code Playgroud)
如何在第二行访问结构A?为什么我还是得到错误?