Regarding comparison of integer and character?

character
integer
string

#1

a is a character array which contains integers 0-9

   1) count=(count*10)+(a*-'0');

   2) if(a*>'9')
    {
        ch=a*;
        printf("{Im executing:%c}",a*);
    }


1)what does the first mean, can a character be computed and subtracted as a normal integer variable or it is a kind of special case.
2)what does the second statement mean?.Does it mean integer is compared with an integer

-----------Help please-----------


#2
  1. Here a* will be stored and used as its ASCII value. For example, ‘0’ will have ASCII value of character ‘0’, i.e. 48. Similarly, a* will be in range of 48-57. Hence, a*-‘0’ will be an integer value between 0-9.

  2. Here a* is simply compared with a character ‘9’. Again, it will be compared with respect to their ASCII values. So, here a character is not compared to an integer. It is an ASCII value compared to another ASCII value. If you want to compare a* with integer value of ‘9’, you can use a*>57.