字符串转换成float和double类型

来源:互联网 发布:javascript基础语法 编辑:程序博客网 时间:2024/06/04 18:26
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;}
0 0
原创粉丝点击