#include <stdio.h>
int main() {
float x;
x=10/4;
printf("%d",x);
}
输出:0
为什么是0啊?如果%d表示整型,不应该是2吗?
#include <stdio.h>
int main() {
float x;
x=10/4;
printf("%d",x);
}
为什么是0啊?如果%d表示整型,不应该是2吗?
这个和数据在内存中的分布有关
建议你看下
https://blog.csdn.net/lolichan/article/details/84895545