Definition | #include <stdlib.h> int atoi(const char *s);
All control characters for white space are legal for tab (see definitiona at The | |
Return val. | Integer value of type | |
for strings formatted as described above and representing a numeric value that lies in the permissible range of integers. | ||
0 | for strings which do not correspond to the syntax described above. | |
|
| |
| in the case of an overflow, depending on the sign. | |
Notes |
| |
Example | The following program converts a string passed in the call (Enter Options) into the corresponding floating-point number. #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) /* Numbers are passed as strings!! A conversion is */ /* required if the numeric value is needed */ { printf("floating : %f\n", atof(argv[1])); return 0; } | |
See also | atoi, atol, strtod, strtol, strtoul |