Answers for "cast a char to a digit"

1

convert char to single digit

char c = '1';
int i = c - '0'; // i is now equal to 1, not '1'
Posted by: Guest on May-28-2021

Browse Popular Code Answers by Language