为什么这段代码打印出n-100?
int hello(int n)
{
for(int i = 0; i < n-100; i++)
{
}
}
int main()
{
int h = hello(12);
cout << hello(12) << " " << h << endl;
}
Run Code Online (Sandbox Code Playgroud)
然而,这两个函数都返回垃圾(分别为2665092和0)
int hello1(int n)
{
for(int i = 0; i < 12; i++);
}
int hello2(int n)
{
(n - 100);
}
Run Code Online (Sandbox Code Playgroud)
我在cygwin环境中使用g ++编译了这段代码.