Created
February 20, 2013 14:12
-
-
Save ikautak/4995791 to your computer and use it in GitHub Desktop.
simple atoi implementation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int simple_atoi(const char* a) { | |
int ans = 0; | |
while (*a != '\0') { | |
ans = ans * 10 + (*a++) - '0'; | |
} | |
return ans; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment