这段C语言代码
unsigned long int a, b, x;
float c, d, y;
a = 6;
b = 2;
x = a/b;
c = 6.0;
d = 2.0;
y = c/d;
printf("\n x: %d \n y: %f \n",x,y);
正常工作并打印输出
x: 3
y: 3.000000
然而,当我将第一行改为这样时
unsigned long long int a, b, x;
我得到了这个输出:
x: 3
y: 0.000000
这真让我糊涂...我没有改变c、d和y的任何内容,为什么会出现这种情况?我在Linux上使用gcc。