With the atoi
there is no way of finding out if the passed string really is a number, as there is no special error "return". It also only handles decimal values (base 10), so can't handle arbitrary bases like e.g. strtol
. Also it can't handle values larger than signed integer (32 bits on most platforms).