Skip to content

Instantly share code, notes, and snippets.

@jeonghwan-kim
Created October 12, 2013 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeonghwan-kim/6947738 to your computer and use it in GitHub Desktop.
Save jeonghwan-kim/6947738 to your computer and use it in GitHub Desktop.
Convert string to integer
int str_to_int(char *str) {
int i = 0;
while (*str >= '0' && *str <= '9')
i = i * 10 + *str++ - '0';
return i;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment