convert a string to integer representation
#include <stdlib.h> int atoi( const char *ptr );
The atoi() function converts the string pointed to by ptr to int representation.
The converted value.
#include <stdlib.h>
void main()
{
int x;
x = atoi( "-289" );
}
ANSI
| Safety: | |
|---|---|
| Interrupt handler | Yes |
| Signal handler | Yes |
| Thread | Yes |
atol(), itoa(), ltoa(), sscanf(), strtol(), strtoul(), ultoa(), utoa()