Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - In C language, how to convert a string (all composed of numbers) into floating-point numbers?
In C language, how to convert a string (all composed of numbers) into floating-point numbers?
Use the atoi function to convert a string to an integer, and then use an integer to convert it to a floating-point type.

Atoi C language library function name: atoi function: convert a string into an integer. Name Source: Abbreviation from array to integer. Prototype: Intatoi (constchar * nptr); Function description: parameter nptr string, if the first non-empty character does not exist or is not a number or symbol, it will return zero; otherwise, it will start type conversion, and then stop conversion and return integer \0 when non-number or terminator is detected. Header file: # include