How can I convert a string to a number?

The standard C library provides several functions for converting strings to numbers of all formats (integers, longs, floats, and so on) and vice versa.  The following functions can be used to convert strings to numbers: Function Name Purpose atof() Converts a string to a double-precision floating-point value. atoi() Converts a string to an integer. atol() Converts a string to a long integer. strtod() Converts a string to a double-precision floating-point value and reports any “leftover” numbers that could not be converted. strtol() Converts a string to a long integer and reports any “leftover” numbers that could not be converted. strtoul() Converts a string to an unsigned long integer and reports any “leftover” numbers that could not be converted.  

Showing Answers 1 - 1 of 1 Answers

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions