Skip to content Skip to sidebar Skip to footer

Data Type Modifiers in C++

As we know, data types are essential to declare a variable in our program, but isn’t the efficiency of our program important? Don’t you think so? The answer is “Yes, it is“; hence, in C++, an introduction to data type modifiers is crucial. Let’s understand the Modifiers in C++ to get the answer “what are the modifiers?

What are the Modifiers?

Modifiers are nothing but an extension to the data types, making using the built-in or primitive data types more efficient along with our program by modifying the meaning of the primary type so that the requirements of any case or situation can be satisfied. 

We use these data type modifiers as a prefix in primitive data types, which improves the primitive data types and enhances their usage.

In C++, we have about four types of data type modifiers, that are:

  • Signed
  • Unsigned
  • Long
  • Short 

We can use these modifiers as a prefix in front of the int, floatdouble, and char, i.e., the primitive data types we learned about in our primitive data types blog.

Types Of Data type Modifiers


We use this modifier as a prefix for only int and char data types. It stores only the Positive, Negative, and the Zero when used for integer data types. The range of the maximum and minimum values a signed int variable can store is -2147483648 to 2147483647, and a signed char is this -127 to 127 or 0 to 255.


An unsigned modifier is used only for the int and char data types. But unlike the signed modifiers, it stores only a positive or zero value. The maximum and minimum values range that a variable declared as unsigned int is 0 to 4294967295, and an unsigned char is 0 to 255.


As the name suggests, this modifier helps modify the minimum values an int data type can hold. Short int and short are equivalent to each other, hence can be used synonymously. The range of the values is −32,767 to +32,767


This modifier helps modify the maximum values a data type can hold. Even long int and long are equivalent to each other, hence can be used synonymously. The range of the values long int can hold is -2,147,483,648 to 2,147,483,647

The following table shows various data types with modifiers and their size in bytes

short int/ short2 Bytes-32768 to 32767
signed short          2 Bytes-32768 to 32767
unsigned short2 Bytes0 to 65,535
int4 Bytes-2147483648 to 2147483647
signed int4 Bytes-2147483648 to 2147483647
unsigned int4 Bytes  0 to 4294967295
long int/ long8 Bytes  -2,147,483,648 to 2,147,483,647
signed long8 Bytes -2,147,483,648 to 2,147,483,647
unsigned long8 Bytes0 to 4,294,967,295
long long int8 Bytes-(2^63) to (2^63)-1 
unsigned long long int8 Bytes0 to 18,446,744,073,709,551,615
float4 Bytes1.2E-38 to 3.4E+38
(6 decimal places)
double8 Bytes2.3E-308 to 1.7E+308
(15 decimal places)
long double16 Bytes3.4E-4932 to 1.1E+4932
(19 decimal places)
char1 Byte -127 to 127 or 0 to 255
signed char1 Byte-127 to 127
unsigned char1 Byte0 to 255


So here we got to know all about the extensive knowledge of the core fundamentals in C++, i.e., data types modifiers. Hence you’ve done it well. Practice it once on your compiler/onlinegdb to understand and grasp it well, as coding is all about practical, and theory alone doesn’t render the result and enhance the learning.

Similarly, you must also know that GeekonPeak has just begun, and it is looking for some loyal supporters so we, the new-gen geeky friends, can grow and create more extensive and easy-to-grasp courses for you (for free). You can follow us on FacebookInstagram & Twitter as well. Also, don’t miss our newsletter subscription. We provide exclusive blogs, tips, tricks, and advice to program efficiently and market smartly. We also promote some of our partners with excellent experiences to share with you. Until next time 🙂

Leave a comment

Sign Up to Our Newsletter

Be the first to know the latest updates