Unsigned int Signed integer addition

void test02(void)
{
 int a= -16;

 printf ( "% u \ n" , a); // complement form, automatically converted to unsigned
 unsigned int J = B;
 IF (A> B) Comparative int // Switch unsigned int then compared, with a + b> 0 results same
  puts ( "negative> n");
 the printf ( "% D \ n-", a + b); // intermediate variables have received a + b value, the output is an intermediate variable, with int c; c A + B =
}

a + b default return is unsigned, if thus obtained is a signed int c; c = a + b; course c <0, but a + b> 0 as a + b = -6 with the symbol It is beyond the scope of unsigned numbers can be represented by a hexadecimal complement form is stored in memory FFFA, i.e. 65530> 0

Guess you like

Origin www.cnblogs.com/1271908407boy/p/11236506.html