码迷,mamicode.com
首页 > 编程语言 > 详细

在C\C++中char 、short 、int各占多少个字节

时间:2018-10-22 10:20:39      阅读:169      评论:0      收藏:0      [点我收藏+]

标签:字节   its   out   namespace   har   name   int   pac   nbsp   

在C\C++中char 、short 、int各占多少个字节 :

#include <bits/stdc++.h>

using namespace std;

int main()
{
    cout <<sizeof(char) <<endl;
    cout <<sizeof(short) <<endl;
    cout <<sizeof(int) <<endl;
    // 输出结果依次是1、2、4
}

 

在C\C++中char 、short 、int各占多少个字节

标签:字节   its   out   namespace   har   name   int   pac   nbsp   

原文地址:https://www.cnblogs.com/GetcharZp/p/9828391.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!