左移

来源:互联网 发布:数据标注员 干嘛的 编辑:程序博客网 时间:2024/04/26 07:36
#include<stdio.h>
#include<stdlib.h>

int main(){
    int j;
    j = 1<<31;//it is ok, j = -2147483648, 32 bits long
    j = 1<<32;//warning: left shift count >= width of type
    printf("%d/n",j);
   return 0;
}

that is to say, 32 is assigned of 32 bits.

Always aware the data types!

shift is fater than * and /
原创粉丝点击