字符串转换成float和double类型

double strtod(const char *nptr, char **endptr);
float strtof(const char *nptr, char **endptr);
long double strtold(const char *nptr, char **endptr);
#include <stdlib.h>

int main()
{
        char *str = "1.1";
        printf("%f\n", strtof(str, NULL));

        return 0;
}
posted @ 2015-10-25 15:12  thomas_blog  阅读(225)  评论(0编辑  收藏  举报