My function takes a large number as input, in the form of a string. I need to store each number in an integer array, but have been unable to do so. When I do a for loop and make array[i] = string[i], it saves the number as its ascii value. I've been trying to convert this number from its ascii value to an integer, but I cant get atoi to work. Any suggestions?
Asked
Active
Viewed 192 times
1 Answers
1
Since the numerals '0'
-'9'
are required to be encoded consecutivly in base character set, the numeric value of a numeral character c
is simply c - '0'
.

Kerrek SB
- 464,522
- 92
- 875
- 1,084
-
1I thought I had tried that, but clearly when I did, I did something wrong. Thanks for the answer! – wcm Apr 13 '15 at 01:08