Data type modifiers in C
सी भाषा में डेटा टाइप मॉडिफ़ायर का उपयोग डेटा प्रकार के वर्तमान गुणों के गुणों को बदलने के लिए किया जाता है। डेटा प्रकार संशोधक को निम्न प्रकारों में वर्गीकृत किया गया है।
- long
- short
- unsigned
- signed
long:
This can be used to increased size of the current data type to 2 more bytes, which can be applied on int or double data types. For example int occupy 2 byte of memory if we use long with integer variable then it occupy 4 byte of memory.
Syntax
long a; --> by default which represent long int.
short
In general int data type occupies different memory spaces for a different operating system; to allocate fixed memory space short keyword can be used.
Syntax
short int a; --> occupies 2 bytes of memory space in every operating system.
unsigned
This keyword can be used to make the accepting values of a data type is positive data type.
Syntax
unsigned int a =100; // right unsigned int a=-100; // wrong
Signed
This keyword accepts both negative or positive value and this is default properties or data type modifiers for every data type.
Example
int a=10; // right int a=-10; // right signed int a=10; // right signed int a=-10; // right
Note: in real time no need to write signed keyword explicitly for any data type.
टिप्पणियाँ
एक टिप्पणी भेजें