c语言左移右移乘除法,c语言中的左移和右移运算(Left shift and right shift in C language).doc...

c语言中的左移和右移运算(Left shift and right shift in C language)

c语言中的左移和右移运算(Left shift and right shift in C language)

"Left shift" and "right shift" in C language (< < > > and < < > >)

---------------------------------------------------------

1, various data formats (integer, int, character type, char, etc.) hold several storage units (different compilers are different)

In TC2.0 and keil: (also the ANSI standard)

Char holds 1 bytes (8 bit binary digits). Unsigned char type variables, the maximum value is 0xff (sixteen hexadecimal), 255 (decimal)

Int holds 2 bytes (16 bit binary digits). Unsigned int type variables, the maximum value is 0xFFFF (sixteen hexadecimal), 65535 (decimal)

Long int holds 4 bytes

Folat holds 4 bytes, and long, float, and double hold 8 bytes, and long double makes up 16 bytes

In VC++:

Char holds 1 bytes, int and float hold 4 bytes, and double occupies 8 bytes

-------------------------------------------------------------------

2. The difference between logical left shift / right shift and left shift / right shift of arithmetic (these two bit operations are only for integer and character type). Not applicable to data in real format

Logical left shift: discards the lowest bit and the 0 complement the msb. (assuming only 1 shifts left) binary number: logical left shift 1, get:Logical right shift: discards the MSB, and 0 makes the lowest bit. (assuming only 1 digits to the right) binary number: logical left shift 1, get:Left shift of arithmetic: the left shift of logic is based on keeping the symbol bit constant. (assuming only 1 shifts left) binary number:Arithmetic right shift: the logical right shift is based on keeping the symbol bit constant. (assuming only 1 digits to the right) binary number:------------------------------------------------------------------

Well, get to the point: discuss it in categories and characters

The following results are debugged by VC++6.0 (1 bytes for char, 4 bytes for int)

One thing to note is tha

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值