当前位置:网站首页>C language learning record--variable basic type and memory size
C language learning record--variable basic type and memory size
2022-08-11 05:45:00 【FussyCat】
1、The memory size of different basic variable types,Compilation bits by system32位和64bits to distinguish,Where there is a difference is the typelong上,在32Compiled by a bit compiler4个字节长度,而在64It is compiled on a bit compiler8个字节.
Some people are pressingLP32 ILP32 LP64 LLP64 ILP64 To divide the byte length of the above data types,可以参考:Interpretation reference for the data model
2、Let's take a look at the above actually10种数据类型,Verify that the byte length in the table is accurate.我的PC是64位的,有32Bit of friends can take a look directly32performance on the spot.
好吧,朋友们,Forgive me for accidentally writing itC++了,该死的Visual Studio,Refill laterC了,This does not affect the byte length calculation.
#include <iostream>
using namespace std;
int main()
{
char char_a = 'a';
char str[] = "\\\\";
char str1[] = "hello";
short short_i = 1;
int int_i = 1;
unsigned uint_i = 1;
long long_i = 1;
long long llong_i = 1;
unsigned long ulong_i = 1;
float float_i = 1.0;
double double_i = 1.0;
char getstr[] = {
0 };
cout << "Hello My C!\r\n";
cout << "char_a size:" << sizeof(char_a) << endl;
cout << "short_i size:" << sizeof(short_i) << ", int_i size:" << sizeof(int_i) << ", uint_i size:" << sizeof(uint_i) << endl;
cout << "long_i size:" << sizeof(long_i) << ", llong_i size:" << sizeof(llong_i) << ", ulong_i size:" << sizeof(ulong_i) << endl;
cout << "float_i size:" << sizeof(float_i) << ", double_i size:" << sizeof(double_i) << endl;
cout << "str size:" << sizeof(str) << ", str1 size:" << sizeof(str1) << endl;
cin >> getstr;
}

3、可以加上unsigned的有char short int long,其他的不可以.
哦,该睡觉了...Tomorrow is another long working day...
边栏推荐
- 原生态mongo连接查询代码
- 性能效率测试
- 【win10+cuda7.5+cudnn6.0安装caffe②】安装Visual Studio 2013和caffe
- (二)Docker安装Redis实战(持久化AOF和RDB快照)
- flaks框架学习:在 URL 中添加变量
- 【CSDN21天学习挑战赛】第一天,配置环境外加实现mnist手写数字识别
- 判断一个字符串是否为空,如果为空,对其赋值,如果不为空,获取字符的个数并打印第一个字符
- 0708作业---商品信息
- [C language from elementary to advanced] Part 2 Initial C language (2)
- Minecraft
猜你喜欢

吃瓜教程task01 第2章 模型评估与选择

深入理解线程、进程、多线程、线程池

pip 国内源下载

Django--20实现Redis支持、上下文以及上下文和接口的交互

(3) How Redis performs stress testing

【win10+cuda7.5+cudnn6.0安装caffe①】安装cuda和cudnn

【win10+cuda7.5+cudnn6.0安装caffe②】安装Visual Studio 2013和caffe

(2) Construction of a real-time performance monitoring platform (Grafana+Prometheus+Jmeter)

【win10+cuda7.5+cudnn6.0安装caffe⑥】报错及处理方式

吃瓜教程task02 第3章 线性模型
随机推荐
【Mysql】----基础练习
pytorch和tensorflow函数对应表
深入理解线程、进程、多线程、线程池
DS220702-0707作业
【CSDN21天学习挑战赛】第一天,配置环境外加实现mnist手写数字识别
(二)Docker安装Redis实战(持久化AOF和RDB快照)
lspci 命令使用
Blender 初教程
imx6 yocto编译备忘
(三)Redis 如何进行压测
【win10+cuda7.5+cudnn6.0安装caffe④】安装pycaffe
吃瓜教程task01 第2章 模型评估与选择
c指针学习(2)
gradle-wrapper.jar说明
Flask framework learning: template inheritance
第9章 内存模型和名称空间
标准模板题:采药
吃瓜教程task05 第6章 支持向量机
Redis - Data Types (Basic Instructions, String, List, Set, Hash, ZSet, BitMaps, HyperLogLog, GeoSpatial) / Publish and Subscribe
task06 PyTorch生态