Skip to content

Instantly share code, notes, and snippets.

@pete
Created May 5, 2009 22:22
Show Gist options
  • Save pete/107247 to your computer and use it in GitHub Desktop.
Save pete/107247 to your computer and use it in GitHub Desktop.
int atoi(char *str)
{
int acc = 0;
while(*str) {
if(*str >= '0' && *str <= '9')
acc = acc * 10 + (*str - 0x30);
else
break;
str++;
}
return acc;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment