C++ Modifier Types

By | September 29, 2021

In this tutorial, we will discuss the various C++ Data Types Modifiers and we will also discuss what is the use of these modifiers.

Data type modifier declaration syntax

<data type modifier> <data type> <variable>;


long int a;

These modifiers used as a prefix to the data types, and modify the data type properties, for example, the storage space of int data type is 4 bytes(32-bit system) but if we use the long modifier with the int then it will occupy 8 bytes.

int a;      // a is an integer data type and it will occupy 4 bytes
long int b;   // b is an integer type but it will occupy 8 bytes

1. long

The long data type modifier enhances the byte size of the primitive data type by 2 bytes, and it can only be used along with int and double data type.

long supported with:

  • int
  • double


long int a=10;
long double b= 200;

2. Short

The int data type occupies different memory space in different systems and it varies from 2 to 4 bytes, the 16-bit systems provide 2 bytes to int whereas the 32-bit systems provide 4 bytes to int. We use the short data type modifier with int so the variable occupies only 2 bytes in every system.


short supported with:

  • int


short int a =32;

3. unsigned

An unsigned data type modifier is used to handle only positive integer values, if you provide a negative integer value to an unsigned int then it will store a garbage value.

Unsigned supported with:

  • int
  • long int
  • char


unsigned int a= 10;     // correct
unsigned int b= -10;         // incorrect (but do not throw any error), garbage value

4. Signed

the signed keyword can be used with int data type and its deal with both positive and negative integers.

signed supported with:

  • int
  • long int
  • char


signed long int a =10;

Type Qualifiers in C++

Qualifiers are similar to access modifies used as a prefix to the data type and provide information about the variable.

Qualifier Description
const The value of the variable can not be changed once assigned
volatile The Qualifier volatile tells the compiler that a variable’s value may be changed throughout the program.
restrict A pointer qualified by restrict is initially the only means by which the object it points to can be accessed.


  • Data type modifiers are the prefix of Data types
  • There are four data type modifiers in C++ long, short, unsigned, signed.
  • These modifiers can alter the properties of data type.
  • Signed and unsigned modifiers can be used as a modifier for long and short modifiers.

People are also reading: 

Author: Vinay

I am a Full Stack Developer with a Bachelor's Degree in Computer Science, who also loves to write technical articles that can help fellow developers.

Leave a Reply

Your email address will not be published.