当前位置:网站首页>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...
边栏推荐
猜你喜欢

我的四核Cortex-A53学习之路

Blender 初教程

手推卷积神经网络参数(卷积核)求导

【CSDN21天学习挑战赛】第一天,配置环境外加实现mnist手写数字识别

【win10+cuda7.5+cudnn6.0安装caffe④】安装pycaffe

家·谱——人脸识别家谱系统

二、Jmeter 核心配置文件

第二篇 DS5 Armv8 样例工程报错之GCC编译

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

(2) Docker installs Redis in practice (persistent AOF and RDB snapshots)
随机推荐
leetcode21.合并两个有序链表
第13章类继承
注解式编程小记
搭建PX4开发环境
C语言自定义类型——枚举类型讲解
【C语言进阶】第一篇深度剖析整数数据在内存中的存储(一)
Flask framework learning: template rendering and Get, Post requests
task03 Pytorch模型定义
c 指针学习(1)
(2) Construction of a real-time performance monitoring platform (Grafana+Prometheus+Jmeter)
字符与字符串
vftpd本地可以连接,远程连接超时的解决
看完这篇博客之后,含着泪学会了TCP/IP
C语言——文件操作函数 fseek、ftell、rewind详解
面试宝典二:nlp常见知识点
判断一个字符串是否为空,如果为空,对其赋值,如果不为空,获取字符的个数并打印第一个字符
Flask框架学习:路由的尾部斜杠
将double类型的数据转为字符串
imx6 yocto编译备忘
深入理解线程、进程、多线程、线程池