c语言int、float、long、char各有多少位

如题所述

第1个回答  2022-09-22

1、在32位系统中:

char(1)字节

short(2)字节

int(2)字节

long(4)字节

char*(4)字节

int*(4)字节

int**(4)字节

2、在64位系统中:

char(1)字节

short(2)字节

int(4)字节

long(8)字节

char*(4)字节

int*(4)字节

int**(4)字节

扩展资料

在C++中short占2字节,int、float、long都占4字节,double占8字节。

指针长度和地址总线有关。因为指针记录的就是一个地址,那么32位的就是4字节,64位的就是8字节。

char占1字节,short占2字节,int、float、long都占4字节,double占8字节,任意类型的指针都占4个字节。