C++数据类型

来源:互联网 发布:nginx 子域名跨域配置 编辑:程序博客网 时间:2024/06/03 22:07



int main()

{

    cout<<"int:"<<sizeof(int)<<endl;

    cout<<"short:"<<sizeof(short)<<endl;

    cout<<"long:"<<sizeof(long)<<endl;

    unsigned long a;

    cout<<"unsigned int:"<<sizeof(unsignedint)<<endl;

    cout<<"unsigned long:"<<sizeof(unsignedlong)<<endl;

    return 0;

}



无符号整型不能存储负数。


计算中中存储的是补吗,需要按位取反末位加一。





0 0
原创粉丝点击