Datatypes in C language | Different types of Datatypes in C

Spread the love

Datatypes :

We have different types of Data like Alphabets, Integers, Decimal point data,..etc. we will deal with each and every data differently Similarly Computers also have Different types of data. They also follow a different type of storage representations for each type of data. So we need to give clear information about the data we are going to use in our programs.C  support different type of data. and C compiler has its own Representation for different data.

We are using Datatypes to distinguish Different types of data. C have Three Fundamental Datatypes,

  1. Integer Datatype [ denoted by int ].
  2. Character Datatype [ denoted by char ].   
  3. Float Datatype [denoted by float ].  
Integer Datatype is used to Storing Integer Values
Ex : 10, 20, 431
Character Datatype is used to Store Single Character.
Ex : ‘V’ , ‘E’ , ‘N’
Float Datatype is used for Storing Floating point values.
Ex : 10.56, 78.37

Float datatype is capable of Display maximum  Six digits after the Point( Decimal point) or Period .
Ex :              431 . 408430 

Example program with different data types:

In the above program, we have one integer variable named i, Which is used to store the decimal value 10. Similarly, we have variable ch   to store character 'a'. Here 'ch'  datatype is char and variable f  is used to store floating point data 12.36.

There are Different Type of Type Qualifiers in C. We are going to discuss about them in details in upcoming tutorials.

  1. Size Qualifiers – short and Long. 
  2. Sign Qualifiers – Signed and Unsigned.

Few points on Sign Qualifiers :

  • When the qualifier signed is used Number may be positive or negative.
  • When the qualifier unsigned is used Number always Positive.
  • If the sign Qualifier is not mentioned, then the default qualifier is signed qualifier. SO value may be positive or Negative.
  • The range of signed values are always less than the Unsigned values because in Signed values Leftmost bit is represents the Sign Value.

Unsigned float and unsigned Double are not allowed in C (Infact it is not a valid Approach according toIEEE 754 Document Real data is not a Number NAT).

> The basic Datatypes and their size and Ranges are given in the Following Table.
Data Type
Format Specifiers
Size
Range
char
%c
1Byte
-128 to 127
int
%d
4 Bytes
-2147483648  to
2147483647.
float
%f
4 Bytes
3.4E-38   to 3.4E+38
double
%lf
8 Bytes
1.7E-308 to 1.7E+308

Venkatesh Macha

Hi Guys, I am Venkatesh Macha. I am a programmer and an Open Source enthusiast, Presently working as a Software Engineer. Apart from that, I love to explore new technologies and things.

You may also like...

1 Response

  1. Glory Pachnanda says:

    Nice article. You describe Qualifiers in a very good way.

Leave a Reply