C++数据类型/大小

本文探讨了在Ubuntu操作系统中,不同C++数据类型的内存占用大小。通过实例展示了char, int, float, double等基本数据类型的字节大小,并讨论了这些大小可能对程序性能和内存使用的影响。" 8495500,1386657,Oracle数据库身份认证方式详解,"['数据库管理', 'Oracle认证', '操作系统认证', '身份验证', '数据库安全']
摘要由CSDN通过智能技术生成
#include<climits>
int main() 
{ 
    using namespace std;
    int n_int=INT_MAX;
    short n_short=SHRT_MAX;
    long n_long=LONG_MAX;
    long long n_llong=LLONG_MAX;

  // float is 4 bytes.
  // double is 8 bytes.
    
   cout<<"char is "<<sizeof(char)<<" bytes."<<endl;
   cout<<"unsigned char is "<<sizeof(unsigned char)<<" bytes."<<endl;     
   cout<<"short is "<<sizeof n_short<<" bytes."<<endl; 
   cout<<"unsigned short is "<<sizeof(unsigned short)<<" bytes."<<endl;
   cout<<"int is "<<sizeof(int)<<" bytes."<<endl; 
   cout<<"unsigned is "<<sizeof(unsigned)<<" bytes."<<endl; 
   cout<<"long is "<<sizeof n_long<<" bytes."<<endl; 
   cout<<"long long is 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值