函數未定義問題
hello.c: In function ‘main’: hello.c:9:13: warning: implicit declaration of function ‘max’ [-Wimplicit-function-declaration] ?int maxNum=max(a1,a2); ? ? ? ? ? ? ^ 每一步都按照視頻走,怎么會出現這個問題?
hello.c: In function ‘main’: hello.c:9:13: warning: implicit declaration of function ‘max’ [-Wimplicit-function-declaration] ?int maxNum=max(a1,a2); ? ? ? ? ? ? ^ 每一步都按照視頻走,怎么會出現這個問題?
2017-03-15
舉報
2017-05-18
在主程序中加一句申明 ? :int max (int a,int b);
2017-03-16
編譯器不同結果會不同,這個是沒聲明,有的版本編譯器可以自動優化這個問題所以不會提出warning。可以在main 函數上加max函數的聲明。