< C++ Programming | Code/Standard C Library | Functions
Exceptions (C) No-throw guarantee: this function never throws exceptions. If str does not point to a valid C-string, or if the converted value would be out of the range of values representable by an int, it causes undefined behavior. See also atol Convert string to long integer (function ) atof Convert string to double (function ) strtol.
atoi[edit]
Atoi C++ Example
![Function Function](/uploads/1/2/5/7/125753217/487684072.png)
Atoi C++ String
Syntax |
The atoi() function converts str into an integer, and returns that integer. str should start with a whitespace or some sort of number, and atoi() will stop reading from str as soon as a non-numerical character has been read. For example:
All five of the above assignments to the variable i would result in it being set to 512.
If the conversion cannot be performed, then atoi() will return zero:
This special offer gives you full member access to our downloads. That's how much we trust our unbeatable service. Vst to rtas converter free. Our members download database is updated on a daily basis.Take advantage of our limited time offer and gain access to unlimited downloads for FREE!
A complete C++ implementation of atoi.
- Related topics
- atof - atol
(Standard C I/O) sprintf
![Cpp Cpp](/uploads/1/2/5/7/125753217/985435983.jpg)
Retrieved from 'https://en.wikibooks.org/w/index.php?title=C%2B%2B_Programming/Code/Standard_C_Library/Functions/atoi&oldid=3676456'