Search This Blog


Monday, September 16, 2019

#4 Tokens of C

➤Datatypes :-

  •  A datatypes defines a domain of allowed values and the operations that can be performed on those values.
  • Storage representation of different datatypes is different in memory.
  • There are four fundamental datatypes in C, which are int,char,float and double.

  ⏩ char is used to store any single character

  ⏩ int is used to store integer value 

  ⏩ float is used for storing single precision floating point number

  ⏩ double is used for storing double precision floating point number 

We can use type qualifiers with these basics types to get some more types.
There are two types of type qualifiers:-
  1. Sign qualifiers  - signed, unsigned 
  2. Size qualifiers  - short, long
  • The qualifiers signed and unsigned can be applied to char and integer types.
  • When the qualifier unsigned is used the number is positive.
  • When the signed is used number may be positive or negative.
  • If the sign qualifier is not mentioned in integers, then by default signed qualifier is assumed.
  • If the sign qualifier is not mentioned for char type, then its depend on machine.
  • The range of values for signed data types is less than that of unsigned type.
  • The qualifiers short and long can be applied to int type to get types short int and long int.
  • The qualifiers long can be applied to double to get type long double.
 The size and range of different datatypes on a 16-bit machine is given in the following table.The size and range may vary on machines with different word sizes.

  1. char data types:- 1 bytes 
  2. int data types :- 2 bytes(int),1 bytes(short int), 4 bytes (long int)
  3. float data types :- 4 bytes
  4. double data types :- 8 bytes(double), 10 bytes(long double)

 ➤ Format specifier/Type specifier :-

  •  Format specifier or type specifier is used for input and output .
  • It tells the compiler about the which type of variable is taken during the inputting and outputting.

      ⏩Some format specifier are:-

  • %c    -     character
  • %d,%i    -   integer
  • %f    -    float
  • %s    -    string
  • %u    -    unsigned decimal integer
  • %o     -    unsigned octal char , etc
If you want full list then comment below👇

No comments:

Post a Comment