Modifier Types in C++

Share on facebook
Share on twitter
Share on linkedin
Share on twitter
Share on tumblr

In this C++ tutorial, we will have a look at the modifier types in C++. A modifier is used to modify the definition of the base category so that it more specifically suits the needs of various situations.

Modifier Types in C++

There is the following C++ modifier in C++.

  • signed
  • unsigned
  • long
  • short

Signed, unsigned, long, and short modifiers can be applied to integer-base types. Signed and unsigned can also be applied to char, and long can be applied to double.

C++ allows short notation of unsigned, short, or long integers. Use the word unsigned, short, or long, without int. It implies int automatically.

For example, these two declarations declare unsigned integer variables.

unsigned a;
unsigned int abc;

Important points about modifiers.

  1. All four modifiers can be added for type int.
  2. Char type allows only signed & unsigned modifiers.
  3. Triple form with a long suffix.
  4. In type allows shorthand notation.
  5. sing modifiers correctly can reduce memory usage.
  6. If we know our variable can never be negative, we should use unsigned modifiers to save memory.

Leave a Comment

Your email address will not be published. Required fields are marked *