implement atoi function.

here it is in C. it handles leading whitespaces & trailing whitespaces.
if characters are found in between numbers, it ignores them.
it allows negative numbers,
and it detects buffer overflows.