C++ Convert Ascii Int To Char To Int -


im able convert things without problem, google search if needed. cannot figure 1 out, though.

i have char array like:

char map[40] = {0,0,0,0,0,1,1,0,0,0,1,0,1... etc 

i trying convert char correct integer, no matter try, ascii value: 48/ 49.

i've tried quite few different combinations of conversions , casts, cannot end 0 or 1, char.

can me out this? thanks.

the ascii range of characters representing integers 48 57 (for '0' '9'). should subtract base value 48 character integer value.

char map[40] = {'0','0','0','0','0','1','1','0','0','0','1','0','1'...}; int integermap[40];  ( int = 0 ;i < 40; i++) {    integermap[i] = map[i] - 48 ;    // or    //integermap[i] = map[i] - '0';   } 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -