+ 2

How we convert character into integer?????

1st Jun 2018, 12:03 PM
Sonia Singh
Sonia Singh - avatar
4 Respostas
+ 6
If you need the ASCII value, char ch = 'd'; int a = ch; // int a = (int) ch is redundant. To convert the character into integer (eg. '1' to 1), char ch = '1'; int c = ch - '0';
1st Jun 2018, 12:16 PM
Dev
Dev - avatar
+ 1
char c = 'a'; int x = (int)c;
1st Jun 2018, 12:14 PM
Bebida Roja
Bebida Roja - avatar
+ 1
it's really work or not?
1st Jun 2018, 12:32 PM
Sonia Singh
Sonia Singh - avatar
+ 1
char a ; cout << int (a);
3rd Jun 2018, 7:13 AM
Aveek Bhattacharyya
Aveek Bhattacharyya - avatar