资讯详情

The size of basic data types

This table gives the size and natural alignment of the basic data types in C or C++.
Type Size in bits Natural alignment in bytes
char 8 1(byte-aligned)
short 16 2(halfword-aligned)
int 32 4(word-aligned)
long 32 4(word-aligned)
long long 64 8(doubleword-aligned)
float 32 4(word-aligned)
double 64 8(doubleword-aligned)
long double 64 8(doubleword-aligned)
All pointers 32 4(word-aligned)
bool (C++ only) 8 1(byte-aligned)
_Bool (C only[1]) 8 1(byte-aligned)
wchar_t (C++ only) 16 2(halfword-aligned)

[1] stdbool.h can be used to define the bool macro in C.

-电子元器件采购网(www.ruidan.com)是本土元器件目录分销商,采用“小批量、现货、样品”销售模式,致力于满足客户多型号、高质量、快速交付的采购需求。 自建高效智能仓储,拥有自营库存超过50,000种,提供一站式正品现货采购、个性化解决方案、选型替代等多元化服务。
锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

锐单商城 - 一站式电子元器件采购平台