Hi guys, we will discuss Data Type Modifiers and their types in this section. This section is significant for beginners to clear their concepts. So without wasting time let's get started.
Data Type Modifiers:
In C Language data type modifiers are keywords that are used to change the current properties of data type.
- Data Type modifiers are classified into the following types:
- Short
- Long
- Signed
- Unsigned
- Modifiers are prefixed with a basic data type to modify (either increase or decrease) the amount of storage space allowed/allotted to a variable.
- Let us have an example to understand it:
- Storage space for int equal to 4 bytes for 32-bit space
- We can increase it to 8 byte
- We can decrease it to 2 byte
Short:
- This sort modifier allows the user to store a small integer value ranging from (-2^15 to 2^15).
- It reserves 2 bytes of memory space.
- It can only be used on the int data type.
- Example:
- short int a = 59;
Long:
- This modifier allows the user to store a very large number.
- It reserves 4 bytes of memory space.
- It can be used with int and double data types.
- Example:
- long int a = 45762;
Signed:
- It is a default modifier of int float and double data type.
- It says that the user can store negative and positive values.
- Example:
- signed int a = - 563;
[By default all are signed so we don't identify that.]
Unsigned:
- When the user wants to store only positive values in a variable then we use an unsigned modifier with the respective data types
- This modifier is used with int float and double data type.
- Example:
- unsigned int a = 567;
That's all for this section, you can also watch videos on YouTube for more information about this concept.