I would suggest you to go through the manual page of atoi() "man atoi".
Here is my answer:
As per manual page of atoi() it convert a sting to an integer.
It will only convert a string which has an integer value i.e
1> char str1 = "123456789"; //string which contains integer value
2> char str2 = "abcD"; //string with non integer values.
So atoi(str1); // will give you a integer value 123456789 but
atoi(str2); // it will give any value, because atoi() won’t detect error.
So basically atoi() is used to convert a string which has valid integer value. It won't work same as on other values.
Hope you understand now. :)