In this section, you will learn how to convert a string represented value into an integer represented value in C. You can see in the given example that we have used the library function atoi() provided by the header file <stdlib.h>, to convert the string value of digits ("100") into int value. The number may consist of an optional sign and a string of digits, then only converted number is returned otherwise 0 is returned. This method can skip the initial whitespace characters like space, tab, new line etc. .
Here is the code:
Output will be displayed as:
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial