Earn while u Learn

Tips tweaks hacks on computer with C C++ VB tutorials and ways to earn money online

ad

Data types in C

C supports a number of Data types. Some frequently used data types are:
      name                 size                                use
       char                 1byte                  to store any character
        int                   2byte                  to store whole numbers
       float                 4byte                  to store real number
      double              8byte                  to store a floating point with value greater than exactness.
      void                  0byte                  to specify an empty set of values
the above mentioned data types are called primary data types.

Type modifiers: the modifiers are used to alter the meaning of the base type to fit the needs of various situations  more precisely.
Except type void, the basic data types may have various modifiers preceding them. These are:
Signed, unsigned, long, short
look at the list below to understand more:

Data type                            Range                                           Byte                   Format
signed char                        -128 to + 127                                   1                           %c
unsigned char                        0to 255                                         1                            %c
short signed int                 -32768 to + 32767                          2                            %d
short unsigned int                   0 to65535                                  2                            %u
long signed int        -2147483648 to + 2147483647             4                            %ld
long unsigned int               0  to 4294967295                         4                             %ld
float                                -3.4e38 to + 3.4e38                             4                              %f
double                            -1.7e308 to + 1.7e308                       8                              %lf
long double                     -1.7e4932 to + 1.7e4932               10                             %Lf

0 comments:

Sign in / Join

Labels