by Dinesh Thakur Category: Puppetting On Strings

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.



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.