text: To return value of a char . For example , 2 is returned for '2' . 10 is returned for ' A ' , 11 for ' B '
code: int val ( char c ) { if ( c >= '0' && c <= '9' ) return ( int ) c - '0' ; else return ( int ) c - ' A ' + 10 ; }