這裏有什麼問題?不要緊,我選擇什麼號碼海峽,它始終是26815615859885194199148049996411692254958731641184786755447122887443528060147093953603748596333806855380063716372972101707507765623893139892867298012168192.00爲什麼strtof總是評估爲HUGE_VAL?
char *str = "2.6";
printf("%f\n", strtof(str, (char**)NULL));
//prints 26815615859885194199148049996411692254958731641184786755447122887443528060147093953603748596333806855380063716372972101707507765623893139892867298012168192.00
整個程序:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
char *str = "2.6";
printf("%f\n", strtof(str, NULL));
return 1;
}
與-Wall編譯:
test4.c:7: warning: implicit declaration of function âstrtofâ
它在這裏工作正常;你在用一種不尋常的方式建設嗎? – 2010-06-02 17:33:12
gcc -o test4 test4.c – user318747 2010-06-02 17:34:17
嘗試'gcc -Wall' – 2010-06-02 17:36:10