簡單問題,為什麼同樣的代碼,結果不一樣呢??
代碼段1:
#include < iostream.h >
int s1 ( int & );
void main ( )
{
int x = 5;
cout << s1 ( x ) << endl;
cout << x << endl;
}
int s1 ( int &abc )
{
return abc *= abc;
}
代碼段2:
#include < iostream.h >
int s1 ( int & );
void main ( )
{
int x = 5;
cout << s1 ( x ) << endl << x << endl;
}
int s1 ( int &abc )
{
return abc *= abc;
}
代碼段1運行結果:
25
25
代碼段2運行結果:
25
5
菜鳥的問題來了,為什麼結果不一樣呢??
前3位答對者有分:))