空気を読まずにマトモなやつを
#include<ctype.h>
int atoi_(const char*str){
  int sign = 0;
  int value= 0;
  while(isspace(*str))++str;
  if(*str == '+')++str;
  else if(*str == '-')sign = 1,++str;
  for(;isdigit(*str);++str){
    value *= 10;
    value += *str-'0';
  }
  if(sign)value = -value;
  return value;
}