Datatypes in C | Format specifiers in C | Uses of datatypes | Programming tutorials | C programming | C programming tutorials

Hello guys, in this article we are going to learn about the datatypes in the C language. It means that we will learn about the different types of data that the C language allows and operates to produce the results.

In our daily life, we come across several datatypes like numerical, alphabetical etc. But in C, there are several other datatypes also available about which we will be going to learn in this article:-
  1.  Integer 
  2.  Short integer
  3.  Long integer
  4. Double 
  5.  Float
  6.  Character
  7. String



In the C language, we need certain terms called ' Format Specifier ' to operate on these datatypes. Each datatype has its own and unique format specifier in the C language. Let us learn about the datatypes, their uses and also about their format specifiers.


 Data Type   
 Format 
specifier
         Uses                         E.g.
 int
    "%d"
      for declaring 
     variables containing
    integers
     int x= 79464;
 short int
     "%hd" for declaring
    Variables
    containing short integers
     int x=10;
 long int
    "%ld"      for declaring
    Variables
    containing long integers
     int y=45646464846744984;
 double     "%lf"
     for declaring 
    variables containing
    decimal values
     double x= 3.59876756
 float      "%f"
     for declaring
    variables containing
    short decimal values
     float x= 2.13
 char     "%c"
     for declaring
    variables containing a 
    single symbol or
    alphabet.
     char c= 'a'

*NOTE:-       "String" is a special datatype. So, we'll learn it later in the arrays chapter in                             details. String is a datatype which can contain a collection of numerical,
                           alphabetical data and special characters in it at the same time.


In our next blogs, we will learn about the "Memory capacity"  of different datatypes in C and also about the ASCII values of the different characters and special symbols allowed in C. If you have any suggestion / Advice for us, feel free to let us know in the comment section. We will be happy enough to know your feedback. Also, your appreciation will motivate us to add more to this blog.

Till then, Stay safe & Stay healthy. Have a nice day!!




Comments