Character parsing for new variable

Viewed 28

I got the character with the value: ('2'; 0x32 excluding the brackets). I'd like the give another variable the value between the ' ', in this case the 2.

Let's say char j='2'; 0x32 ;
int i ;
I've tried:
i=j[1];

I want to take the second variable (2) within the character j, but it doesn't seem to work.

1 Answers

It depends on how you got this value, because in the ASCII / Unicode table, 0x32 (or 50 in decimal) and character 2 are the same.

Perhaps you have errors in how you get this value. If not, then int i = j; will help.

Related