You can use errno global variable. If it is not equal to 0 then there was error and you can check what it was (overflow or other conversion error)
In the case atoi returns 0 and errno == 0 you can be sure that conversion was finished successfully
Something like this:
int val;
val = atoi("bad value");
if (errno != 0)
{
printf("Error");
}
else
{
}