#include <stdlib.h>
|
int
atoi (const char *nptr); |
It is equivalent to:
(int)strtol(nptr, (char **)NULL, 10);
#include <stdlib.h> #include <stdio.h> void main( void ) { /* call to atoi */ char *str = " -56957jdhfjk"; int i = atoi( str ); printf( "result of atoi: %d\n", i ); }
Output
result of atoi: -56957
The atoi function has been deprecated by strtol and its use is not preferred.
© 2005-2007 Nokia |