在ARM C和51 C编译环境下,C语言基本数据类型占用空间大小

在ARM C编译环境下

TypeSize in bitsNatural alignment in bytesRange of values
char81 (byte-aligned)0 to 255 (unsigned) by default. –128 to 127 (signed) when compiled with --signed_chars.
signed char81 (byte-aligned)–128 to 127
unsigned char81 (byte-aligned)0 to 255
(signed) short162 (halfword-aligned)–32,768 to 32,767
unsigned short162 (halfword-aligned)0 to 65,535
(signed) int324 (word-aligned)–2,147,483,648 to 2,147,483,647
unsigned int324 (word-aligned)0 to 4,294,967,295
(signed) long324 (word-aligned)–2,147,483,648 to 2,147,483,647
unsigned long324 (word-aligned)0 to 4,294,967,295
(signed) long long648 (doubleword-aligned)–9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
unsigned long long648 (doubleword-aligned)0 to 18,446,744,073,709,551,615
float324 (word-aligned)1.175494351e-38 to 3.40282347e+38 (normalized values)
double648 (doubleword-aligned)2.22507385850720138e-308 to 1.79769313486231571e+308 (normalized values)
long double648 (doubleword-aligned)2.22507385850720138e-308 to 1.79769313486231571e+308 (normalized values)
wchar_t16 322 (halfword-aligned) 4 (word-aligned)0 to 65,535 by default. 0 to 4,294,967,295 when compiled with --wchar32.
All pointers324 (word-aligned)Not applicable.
bool (C++ only)81 (byte-aligned)false or true
_Bool (C onlya)81 (byte-aligned)false or true

在51 C编译环境下

Data TypesBitsBytesValue Range
bit10 to 1
signed char81-128 — +127
unsigned char810 — 255
enum8 / 161 or 2-128 — +127 or -32768 — +32767
signed short int162-32768 — +32767
unsigned short int1620 — 65535
signed int162-32768 — +32767
unsigned int1620 — 65535
signed long int324-2147483648 — +2147483647
unsigned long int3240 — 4294967295
float324±1.175494E-38 — ±3.402823E+38
double324±1.175494E-38 — ±3.402823E+38
sbit10 or 1
sfr810 — 255
sfr161620 — 65535
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值