求大神帮我看看这段代码!已自行解决
本帖最后由 林爸爸 于 2019-3-1 08:20 编辑#include<stdio.h>
int main()
{
int i;
char j;
float k;
i = 123;
j = 'C';
k =3.14;
printf("size of int is %d\n", sizeof(int));
printf("size of i is %d\n",sizeof(i));
printf("size of char is %d\n",sizeof(char));
printf("size of j is %d\n",sizeof j);
printf("size of float is %d\n",sizeof(float));
printf("size of k is %d\n",sizeof k);
return 0;
}
Ubuntu下运行不了,Windows可以是Ubuntu配置问题还是码错了
warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ 很可能是Ubuntu出错
代码没有问题
感觉学c还没有必要在Ubuntu进行
原因找到了!
format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int
把%d换成%ld完美运行
页:
[1]