#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
char aaa[35] = "1.25";
char* bbb = &(aaa[0]);
char** ccc = &(bbb);
float a = strtof(*ccc, ccc);
printf("%f\n", a);
return 0;
}
我上面寫的代碼應該打印1.25
,但根據鍵盤(在線C編譯器),它不打印1.25
。在鍵盤上,它打印2097152.000000
。這裏的codepad link爲什麼strtof不能打印正確的浮點數?
我在這裏做錯了什麼?
它是什麼打印呢?我在ideone上得到了[1.250000](http://ideone.com/Rs0Aru) –
http://codepad.org/當上面的代碼被編譯並運行時,不會打印出1.25的代碼 –
那麼你會得到什麼輸出? –