Type modifiers: signed, unsigned, short, long

Home / C Programming / Type modifiers: signed, unsigned, short, long

Type modifiers: signed, unsigned, short, long


C programming, type modifiers are used to further specify the behavior and characteristics of certain data types. The commonly used type modifiers are:

1. signed: The "signed" modifier is used with integer data types (int, char, short, long) to indicate that the variable can hold both positive and negative values. It is the default behavior if the signed keyword is not explicitly specified.


2. unsigned: The "unsigned" modifier is also used with integer data types to indicate that the variable can hold only non-negative values. It extends the range of positive values that can be stored but sacrifices the ability to store negative values.

3. short: The "short" modifier is used with the int data type to indicate that the variable can hold smaller values than a regular int. It occupies less memory than a regular int.

4. long: The "long" modifier is used with the int data type to indicate that the variable can hold larger values than a regular int. It occupies more memory than a regular int.