Basic data types in C language

Cheat Sheet:

char -128 ~ +127 (1 Byte)
short -32767 ~ + 32768 (2 Bytes)
unsigned short 0 ~ 65536 (2 Bytes)
int -2147483648 ~ +2147483647 (4 Bytes)
unsigned int 0 ~ 4294967295 (4 Bytes)
long == int
long long -9223372036854775808 ~ +9223372036854775807 (8 Bytes)
double 1.7 * 10^308 (8 Bytes)

Unsigned int 0~4294967295 
Maximum value of long long: 9223372036854775807
Minimum value of
long long: -9223372036854775808 Maximum value of unsigned long long: 1844674407370955161

Maximum value of __int64: 9223372036854775807
Minimum value of __int64: -9223372036854775808
Maximum value of unsigned __int64: 18446744073709551615

 

 Symbol Attribute  Length Attribute  Basic Type  Occupied Bits          Value Range Input Symbol Example Output Symbol Example                         

    char                                                    8 -2^7 ~ 2^7-1               %c %c  %d %u  

    signed -- char                       8 -2^7 ~ 2^7-1                     %c %c  %d %u             

    unsigned -- char                            8 0 ~ 2^8-1                            %c %c  %d  %u

    [signed] short [int]                         16 -2^15 ~ 2^15-1                  %hd

    unsigned short [int]                          16 0 ~ 2^16-1                     %hu  %ho %hx  

    [signed] -- int                         32 -2^31 ~ 2^31-1                         %d 

    unsigned -- [int]                      32 0 ~ 2^32-1                               %u  %o  %x

    [signed] long [int]               32 -2^31 ~ 2^31-1                              %ld
    unsigned long [int]              32 0 ~ 2^32-1                                   %lu  %lo  
%lx
    [signed] long long [int]        64 -2^63 ~ 2^63-1                              %I64d
    unsigned long long [int]      64 0 ~ 2^64-1                                    %lld,              %llx

    -- -- float                            32 +/- 3.40282e+038                         %f  %e  
%g
    -- -- double                        64 +/- 1.79769e+308                         %lf  %le  %lg %f  %e  
%g
    -- long double                       
96 +/- 1.79769e+308     %Lf  %Le %Lg                  


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326058467&siteId=291194637