Implement the atoi function

Implement the atoi function as efficiently as you can..
How do you handle errors if you had to
How do you handle integer overflow errors

Implement the atoi function

#include
#include
int atoii(char *);
main()
{
char a[] = "1346";
printf("the value is :%d\n",atoi(a));
printf("the equivalent integer value is:%d\n",atoii(a));
}
int atoii( char *s)
{
int n;
n = 0;
for( ;*s >='0' && *s <= '9' ;++s)
n= n*10 + (*s - '0');
return n;
}