Or, more intuitively:
if ((ch>='0')&&(ch<='9'))
{
int actual_digit = ch-'0';
// do something with actual digit
}
or even
if (isdigit(ch))
{
int actual_digit = ch-'0';
// do something with actual digit
}