このコードが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;
}
ただし、これらの関数は両方ともガベージを返します(それぞれ2665092と0)
int hello1(int n)
{
for(int i = 0; i < 12; i++);
}
int hello2(int n)
{
(n - 100);
}
cygwin環境でg++を使用してこのコードをコンパイルしました。