Reading from right to left, cast each char to int then subtract the ASCII value of zero, multiplying by 10 more than the last. Can also be used with float.

[CODE]#include

include

int main(){
int result = 0;
int multiplier = 1;
int end = 0;
char buffer[512];;
gets(buffer);
while (buffer[end+1] != '\0')end++;
for (; end >= 0; end--) {
result += (buffer[end] - 48) multiplier;
multiplier
= 10;
}
printf("%d\n", result);
}[/CODE]