Atoi - Convert String To Integer
Maybe your like
cplusplus.com
Output:
- TUTORIALS
- REFERENCE
- ARTICLES
- FORUM
C++
- Tutorials
- Reference
- Articles
- Forum
Reference
C library:
- <cassert> (assert.h)
- <cctype> (ctype.h)
- <cerrno> (errno.h)
- C++11 <cfenv> (fenv.h)
- <cfloat> (float.h)
- C++11 <cinttypes> (inttypes.h)
- <ciso646> (iso646.h)
- <climits> (limits.h)
- <clocale> (locale.h)
- <cmath> (math.h)
- <csetjmp> (setjmp.h)
- <csignal> (signal.h)
- <cstdarg> (stdarg.h)
- C++11 <cstdbool> (stdbool.h)
- <cstddef> (stddef.h)
- C++11 <cstdint> (stdint.h)
- <cstdio> (stdio.h)
- <cstdlib> (stdlib.h)
- <cstring> (string.h)
- C++11 <ctgmath> (tgmath.h)
- <ctime> (time.h)
- C++11 <cuchar> (uchar.h)
- <cwchar> (wchar.h)
- <cwctype> (wctype.h)
Containers:
- C++11 <array>
- <deque>
- C++11 <forward_list>
- <list>
- <map>
- <queue>
- <set>
- <stack>
- C++11 <unordered_map>
- C++11 <unordered_set>
- <vector>
Input/Output:
- <fstream>
- <iomanip>
- <ios>
- <iosfwd>
- <iostream>
- <istream>
- <ostream>
- <sstream>
- <streambuf>
Multi-threading:
- C++11 <atomic>
- C++11 <condition_variable>
- C++11 <future>
- C++11 <mutex>
- C++11 <thread>
Other:
- <algorithm>
- <bitset>
- C++11 <chrono>
- C++11 <codecvt>
- <complex>
- <exception>
- <functional>
- C++11 <initializer_list>
- <iterator>
- <limits>
- <locale>
- <memory>
- <new>
- <numeric>
- C++11 <random>
- C++11 <ratio>
- C++11 <regex>
- <stdexcept>
- <string>
- C++11 <system_error>
- C++11 <tuple>
- C++11 <type_traits>
- C++11 <typeindex>
- <typeinfo>
- <utility>
- <valarray>
<cstdlib> (stdlib.h)
functions
- C++11 _Exit
- abort
- abs
- C++11 at_quick_exit
- atexit
- atof
- atoi
- atol
- C++11 atoll
- bsearch
- calloc
- div
- exit
- free
- getenv
- labs
- ldiv
- C++11 llabs
- C++11 lldiv
- malloc
- mblen
- mbstowcs
- mbtowc
- qsort
- C++11 quick_exit
- rand
- realloc
- srand
- strtod
- C++11 strtof
- strtol
- C++11 strtold
- C++11 strtoll
- strtoul
- C++11 strtoull
- system
- wcstombs
- wctomb
functions (non-standard)
- itoa
types
- div_t
- ldiv_t
- C++11 lldiv_t
- size_t
macro constants
- EXIT_FAILURE
- EXIT_SUCCESS
- MB_CUR_MAX
- NULL
- RAND_MAX
- Reference
- <cstdlib>
- atoi
Parameters
str C-string beginning with the representation of an integral number.Return Value
On success, the function returns the converted integral number as an int value. If the converted value would be out of the range of representable values by an int, it causes undefined behavior. See strtol for a more robust cross-platform alternative when this is a possibility.Example
| 1234567891011121314 | /* atoi example */ #include <stdio.h> /* printf, fgets */ #include <stdlib.h> /* atoi */ int main () { int i; char buffer[256]; printf ("Enter a number: "); fgets (buffer, 256, stdin); i = atoi (buffer); printf ("The value entered is %d. Its double is %d.\n",i,i*2); return 0; } |
| Enter a number: 73 The value entered is 73. Its double is 146. |
Data races
The array pointed by str is accessed.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
atolConvert string to long integer (function)atofConvert string to double (function)strtolConvert string to long integer (function) Home page | Privacy policy© cplusplus.com, 2000-2025 - All rights reserved - v3.3.4s Spotted an error? contact usTag » What Is Atoi In C
-
C Language: Atoi Function (Convert String To Integer) - TechOnTheNet
-
C Library Function - Atoi() - Tutorialspoint
-
Write Your Own Atoi() - GeeksforGeeks
-
Atoi() — Convert Character String To Integer - IBM
-
Atoi Is A Function In The C Programming Language That ... - Wikibooks
-
Atoi() Function In C - Javatpoint
-
ATOI Function In C - Linux Hint
-
[C언어/C++] Atoi, Atof, Atol 함수 (char* To Int) - 개발자 지망생
-
Atoi In C++: An Ultimate Guide To Atoi() Function - Simplilearn
-
What Is An Atoi Function In C Programming? - Quora
-
Where Did The Name `atoi` Come From? - Stack Overflow
-
C Atoi() Function With Examples | Learn ETutorials
-
- Atoi()
-
Atoi