[問題] printf變數型態問題

看板C_and_CPP作者 (小強)時間13年前 (2012/07/04 23:30), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串1/2 (看更多)
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) GCC 問題(Question): #include <stdio.h> int main(void) { int a=5; float b=5; printf("%f\t%d\n", a/2,a/2); printf("%f\n",a/2); printf("%d\n"a/2); printf("%f\t%d\n", b/2,b/2); printf("%f\n",b/2); printf("%d\n",b/2); } (1)為什麼發亮的地方是0??? (2)為什麼順序的不同會造成結果不同?? [output] 0.000000 4199093(亂數) 0.000000 2 2.500000 0 2.500000 0 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 111.243.165.67

07/04 23:40, , 1F
你那裡順序不同了?
07/04 23:40, 1F
文章代碼(AID): #1Fz65wY6 (C_and_CPP)
文章代碼(AID): #1Fz65wY6 (C_and_CPP)