C库函数 - atof()
C库函数 - atof() #include <stdio.h> #include <stdlib.h> #include <string.h> int main () { float val; char str[20]; strcpy(str, "98993489"); val = atof(str); printf("String value = %s, Float value = %f\n", str, val); strcpy(str, "codingdict.com"); val = atof(str); printf("String value = %s, Float value = %f\n", str, val); return(0); }
C库函数 - atof()
#include <stdio.h> #include <stdlib.h> #include <string.h> int main () { float val; char str[20]; strcpy(str, "98993489"); val = atof(str); printf("String value = %s, Float value = %f\n", str, val); strcpy(str, "codingdict.com"); val = atof(str); printf("String value = %s, Float value = %f\n", str, val); return(0); }
交流与评论