J
Jian H. Li
Hello,
As a beginner to C++, I need Your kind help to clarify the basic
concept. The sample C++ code as following:
int i; // A
i++; // B, error
int main()
{
i++; // C
return 0;
}
Though both are legal C++ statement, //A & //B are different in this
code. //A is correct but //B is wrong. The same as statement //A, //B
is legal also, but //B can't occur outside function body. After moving
//B to position //C, the error alert disapeared. PLEASE EXPLAIN WHY.
Thank you.
Your Sincerely
Joe Li
As a beginner to C++, I need Your kind help to clarify the basic
concept. The sample C++ code as following:
int i; // A
i++; // B, error
int main()
{
i++; // C
return 0;
}
Though both are legal C++ statement, //A & //B are different in this
code. //A is correct but //B is wrong. The same as statement //A, //B
is legal also, but //B can't occur outside function body. After moving
//B to position //C, the error alert disapeared. PLEASE EXPLAIN WHY.
Thank you.
Your Sincerely
Joe Li