C++与Java基本数据类型比较

来源:互联网 发布:移动5g网络 编辑:程序博客网 时间:2024/05/18 03:50


C++与Java基本数据类型及所占用内存空间比较

----------------C++-----------                              ------------Java----------

(01)bool------------------1 byte                         01)boolean--1 byte

(02)char------------------1 byte                         02)char------2 bytes

(03)signed char---------1 byte                         03)byte------1 byte

(04)unsigned char------1 byte

(05)wchar_t--------------2 bytes

(06)short-----------------2 bytes                        04)short-----2 bytes

(07)unsigned short-----2 bytes

(08)int--------------------4 bytes                        05)int---------4 bytes

(09)unsigned int--------4 bytes

(10)long------------------4 bytes                      06)long-------8 bytes

(11)unsigned long-------4 bytes

(12)long long-------------8 bytes

(13)unsigned long long--8 bytes

(14)float-------------------4 bytes                      07)float-------4 bytes

(15)double----------------8 bytes                      08)double----8 bytes

(16)long double---------12 bytes


易知,java中的基本数据类型只有 8 个,

C++的基本数据类型要多一些

0 0
原创粉丝点击