{
If (ch & gt;='0' & amp; & Ch<='9')
//return a '9' - (ch - '0'); Why change to below that will be out of the code
Return a '9' - ch;
return ch;
}
Int main ()
{
Char c1 and c2.
Printf (" \ nThe result: \ n ");
C1='2';
C2=fun (c1);
Printf (" c2 c1=% c=c % \ n ", c1, c2);
C1='8'; C2=fun (c1);
Printf (" c2 c1=% c=c % \ n ", c1, c2);
C1='a'; C2=fun (c1);
Printf (" c2 c1=% c=c % \ n ", c1, c2);
}
[code=c] [code]=c[/code] [/code]
CodePudding user response:
//return a '9' - (ch - '0'); Why change to below that will be out of the codeReturn a '9' - ch;
//////////////////
(ch - '0') transformed into numerical
Return a '9' - (ch - '0'); As' 9 '- numerical results for the characters' 0' to '9'
Return a '9' - ch; As' 9 'characters, the results for the number 0-9
CodePudding user response:
Because '9' - '1' and '9' 1 is different, the first eight, the second '8', so that the output '8' 8, the output of 8 is what? You can look it up in the ASCII table