Originally Posted by
Kybo_Ren
No.
First he would have to checking that string[a] is an actual number (between '0' and '9').
he already is doing that --- 10 times.
Code:
isdigit(string[a]) ? num = (string[a] - '0') : /*call to a function to handle errors*/;
even more efficient (depending on how many times string[a] is used without it's value changing - i haven't really look at the code):
Code:
char current = string[a]; //or even register char current = string[a];
isdigit(current) ? num = (current - '0') : /*call to a function to handle errors*/;