down vote
Depends on what you want to do:to read the value as an ascii code, you can write
- الكود:
char a = 'a';
int ia = (int)a;
/* note that the int cast is not necessary -- int ia = a would suffice */
to convert the character
[/size]
- الكود:
'0' -> 0
,
[/size]
- الكود:
'1' -> 1
, etc, you can write
[/size]
- الكود:
char a = '4';
int ia = a - '0';
/* check here if ia is bounded by 0 and 9 */