[問題] stdio
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
devc
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
main.c內有include stdio.h
我又建了一個one.c
在裡面寫了一個函數test, test裡有用到printf
run後有秀出printf的結果
我的問題是........
one.c為什麼不用include 就可以用printf呢?
及....不用在前面宣告函式一次(void test(void);)
編譯器沒報錯呢?
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
程式碼(Code):(請善用置底文網頁, 記得排版)
//main.c
#include <stdio.h>
int main(int argc, char *argv[]) {
test();
return 0;
}
----------------
//one.c
void test(void){
printf("1234");
}
補充說明(Supplement):
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.25.178.63
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1440208800.A.292.html
推
08/22 10:10, , 1F
08/22 10:10, 1F
→
08/22 10:10, , 2F
08/22 10:10, 2F
→
08/22 10:11, , 3F
08/22 10:11, 3F
printf對得上是指?
one.c沒有stdio.h 就可用printf是預設有stdio嗎?
您的意思是 如果int test(void),就會報錯?
→
08/22 11:46, , 4F
08/22 11:46, 4F
→
08/22 11:47, , 5F
08/22 11:47, 5F
原來如此.........小懂了!
※ 編輯: GooLoo (114.25.178.63), 08/22/2015 11:52:37
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章