这个奇怪的输出我与以下c程序的奇怪输出混淆。 我使用TURBOC和DEVC编译C - 为什么在printf()
我将非常高兴,如果有人可以帮助我在这。
计划
#include<stdio.h>
#include<conio.h>
int main()
{
clrscr();
printf("%d","hb");
printf("%d","abcde"-"abcde");
//Output is -6 why ?
return 0;
}
输出 对于TURBOC
printf("%d","hb");
//Output is 173 Why ?
// No matter what I write in place of "hb" the output is always 173
printf("%d","abcde"-"abcde");
//Output is -6 why ?
对于开发的C
printf("%d","hb");
//Output is 4210688 Why ?
// No matter what I write in place of "hb" the output is always 4210688
printf("%d","abcde"-"abcde");
//Output is 0 why ?
你应该只写'printf(“hdfetgdffgddb”)'。 – Schizo
您使用了错误的类型转换“%d”而不是“%s”。 %d是整数,%s是字符串 – Zorgatone
未定义行为未定义,集71837469. –