我无法向自己解释,为什么会给出 87。我的 IDE 是代码块,而我的编译器是 GNU GCC 编译器。
unsigned long getHigherValue(unsigned long Value1, unsigned long Value2);
int main(){
int a, b = 20;
b = 22;
/*============
It works fine if I replace the two lines above with "int a = 20; int b = 22"
=============*/
int c = getHigherValue(a, b);
printf("%d", c);
return 0;
}
unsigned long getHigherValue(unsigned long Value1, unsigned long Value2){
unsigned long HigherValue = Value2;
if(Value1 > Value2){
HigherValue = Value1;
}
if(Value1 == Value2){
HigherValue = 0;
}
return HigherValue;
}
输出:
87