#include #include #include int main(int argc, const char *argv[]) { char *p = "120"; printf("%ld\n", atol(p)); // atol: 转换成长整型 p = "12.3"; printf("%.2f\n", atof(p)); // atof: 转换成浮点数 return 0; }