這個奇怪的輸出我與以下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. –