Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - In C program: char c 1= 197, c2= 198, what information will be output in decimal, and why?
In C program: char c 1= 197, c2= 198, what information will be output in decimal, and why?
The test center char type variable stores the ASCII code of characters, which is the decimal value of 10. 1 byte, unsigned shaping. Therefore, the range of representation is 0-255. When changing char to int, we should consider the positive and negative numbers of numbers.

Test site 2: the complement of negative number: the complement of negative number is the bit-by-bit inversion of its original code, except the sign bit; Then add 1 to the integer.

So let's look at it backwards:

The binary corresponding to 197 is:110001kloc-0/,regardless of the sign bit. Subtract1=11000100, and then negate all sign bits =1011,and the first bit is 65438. The following 01111is written as 10, which is equal to 32+ 16+8+2+ 1=59, so it is neutralized. Similarly, Char2 = 65438.

Good luck to the landlord!