Format Specifiers And Data Types In C language

Data TYpes and format specifiers of c




In C language there are 4 format specifiers which specify the data,that the given input belongs to which type of data.The Four types of Format specifiers are given below.

Format Specifies:

Numeric               %d        ( 0 to 9 )     
Decimal                %f        ( 9.8 ,7.6 )
Character             %c       (  ‘b’  , ‘a’ )
Characters              %s     (“ Coder”, “Karachi”)

Data Types:

                     
There are three types of data in C.
Int  ( integer ):

                           The type of data which is designed for the work with the integer values.
e.g    { int x = 5 ; }
Float  ( Decimal ) :

                             
      This type of data contains values such as 8.98 , 9.76.
       e.g          { float x = 9.87 ; }
Double : 

                 
This type of data is used to define big floating numbers.
e.g  { double x = 899766666.78 ; }

Char   ( Character ):

                 
The type of data which is used to define the character.single character must be written in single code like ‘b’,’a’.
e.g {  char x = ‘a’ ; }



Variables:

                 
Variable is nothing its just a name which is given to the storage area that our program can manipulate.Each variable in C has a specific type for size and layout of variables memory.
Rules Of Naming The Variables:

1.    First word must be a lower cap alphabates.
2.    Space can not be valid.
3.    Only accepts special character underscore _ .

Identifiers:

                   
Identifiers are created to give unique names to object in a program. An identifier is a sequence of letters, digits, and the special character _. A letter must b a first character of an identifier.


Constants:

                  
Constants are the terms which can not be changed during the execution of a program.

Post a Comment