1. 程式人生 > >C語言資料對應的位元組大小

C語言資料對應的位元組大小

16位編譯器
char :1個位元組
char*(即指標變數): 2個位元組
short int : 2個位元組
int:  2個位元組
unsigned int : 2個位元組
float:  4個位元組
double:   8個位元組
long:   4個位元組
long long:  8個位元組
unsigned long:  4個位元組

32位編譯器
char :1個位元組
char*(即指標變數): 4個位元組(32位的定址空間是2^32, 即32個bit,也就是4個位元組。同理64位編譯器)
short int : 2個位元組
int:  4個位元組
unsigned int : 4個位元組
float:  4個位元組
double:   8個位元組
long:   4個位元組
long long:  8個位元組
unsigned long:  4個位元組
64位編譯器
char :1個位元組
char*(即指標變數): 8個位元組
short int : 2個位元組
int:  4個位元組
unsigned int : 4個位元組
float:  4個位元組
double:   8個位元組
long:   8個位元組
long long:  8個位元組
unsigned long:  8個位元組