Modifier in C++


MODIFIER IN C++

 

In a C++ language have Data Modifier keyword that use to modify the data type in C++.

By this modifier we can increase and decrease the storage range of the data type.

 

MODIFIER IN C++
{tocify} $title={Table of Contents}

For example:-

                                Storage space for int data type is 4 byte for 32 bit processor. We can increase the range by using long int which is 8 byte. We can decrease the range by using short int which is 2 byte.

 

In a C++ data modifier are divide into four type:-

 

v         ðŸ‘‰  Long

v         ðŸ‘‰  Short

v          👉  Signed

v          👉  Unsigned

 

DATA TYPE

SIZE IN BYTES

EXAMPLE

DEFINITION

Short

2

short int a;

Occupies 2 bytes of memory space in every operating system

Long

At least 4  bytes

long a;

In long modifier we did not need to write data type name because it default for int data type.

Unsigned long

4

Unsigned long int a;

Used for positive large integers.

Long long

8

Long long int a;

Used for very large integers.

Unsigned long long

8

Unsigned long long int a;

Used for very large positive integers.

long double

10 bytes

long double a;

Used for large floting point number.

Signed char

1

Char a;

Used for character (in range -127 to 127).

Unsigned char

1

Unsigned char a;

Used for character (in range 0 to 255).

Signed int

4

Signed int a;

Used for integers.

Unsigned int

4

Unsigned int a;

Used for non-negative integers.


Data science & data analyst

C++

Algorithms

Technology

Post a Comment

Ask any query by comments

Previous Post Next Post