1. 程式人生 > >C++與Java基本資料型別比較

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++的基本資料型別要多一些