Wednesday, December 23, 2009

Data Types in C/C++

Type--Size in Bits--Range

char--8-- -127 to +127
unsigned char--8-- 0 to 255
signed char--8-- -127 to +127
int-- 16 or 32 -- -32767 to 32767
unsigned int-- 16 or 32-- 0 to 65535
signed int-- 16 or 32-- -32767 to 32767
short int-- 16-- -32767 to 32767
unsigned short int-- 16 -- 0 to 65535
signed short int -- 16 -- -32767 to 32767
long int & signed long int-- 32 -- -2147438647 to +2147438647
unsigned long int -- 32 -- 0 to 4294967295
float -- 32 -- Six digits of precision
double -- 64 -- Ten digits of precision
long double -- 80 -- Ten digits of precision

P.S. All the data types are application in C++ as well will additional bool and wchar_t.

1 comment:

  1. sizeof(long double) = 12 bytes = 96 bits in linux
    = 16 bytes = 128 bits in solaris

    ReplyDelete