void show_bits(int n) { int i = 0; for(i=0;i<32;i++) printf("%d",(n&(1u<<(31-i)))!=0?1:0); putchar('\n'); }
整数的原码 = 整数的补码html
负数的补码:(原码)->(反码)->(反码+1)post
负数的原码:(补码-1)->最高位符号位别动其他均转反码code
void show_bits(int n) { int i = 0; for(i=0;i<32;i++) printf("%d",(n&(1u<<(31-i)))!=0?1:0); putchar('\n'); }
整数的原码 = 整数的补码html
负数的补码:(原码)->(反码)->(反码+1)post
负数的原码:(补码-1)->最高位符号位别动其他均转反码code
转载于:https://www.cnblogs.com/start2014/p/4005764.htmlhtm