#include<stdio.h>
int main(){
int ret = 0;
ret = func(1.0,2.0);
printf("\n ret : %d \n",ret);
return 0;
}
func(int a,int b){
float m = 5.0;
float n = 6.0;
int sum = m + n;
printf("\n sum : %d \n",sum);
return a+b;
}
已编辑
总和:11
回复:-877505847
为什么传递给整数的浮点值会抛出垃圾值,而在函数内部添加并分配给整数的浮点值会给出正确的值 11 ?