Modifier in C / C ++

C ++ allows data types char, int and double to have Modifiers placed before them. A Modifier is used to inform the meaning of the base type, making it more accurate with the necessity of diverse situations.

Here are the Modifiers in C / C ++:

  1. signed (signed)
  2. unsigned (no sign)
  3. long
  4. short

Modifiers are: signed, unsigned, long, and short can be applied to integer types. Also, signed and unsigned can be applied to char, and long can be applied to type double.

The signed and unsigned Modifiers can also be used as prefixes for Modifiers that are long or short modifiers. For example: unsigned long int.

C ++ allows the type of declaration to be shortened to declare unsigned, short, or long integer. You can simply use unsigned words , short , or long , without int. The following example illustrates two declarations that are valid in C / C ++ to declare unsigned integer variables:

 unsigned x ; unsigned int y ; 

To distinguish the difference between two Modifiers is signed integer and unsigned integer interpreted by C / C ++, you should run the following program:

 #include using namespace std ; /* Chuong trinh nay chi ra diem khac nhau giua * cac so nguyen signed va unsigned. */ int main () { short int i ; // mot so nguyen signed short int short unsigned int j ; // mot so nguyen unsigned short int j = 32769 ; i = j ; cout << i << " " << j ; return 0 ; } 

It will result:

 - 32767 32769 

If you go back to the Data type chapter in C / C ++ , and read the range of values ​​of short int and unsigned short int, you will notice the difference when running the above program with j <= 32767 and with j> = 32767.

Qualifier in C / C ++

The Qualifier provides additional information about the variables that follow it.

Qualifier Thoughtaconst The object of const type cannot be changed by the program while executing volatile Modifier tells the compiler that the value of the variable can be changed indistinct (unannounced) by the program. restrict A pointer is set to restrict , which means that the object it points to can be accessed. Restrict is added in the C99 standard.

According to Tutorialspoint

Previous article: Hang (Constant / Literal) in C / C ++

Next lesson: Storage Class (Storage Class) in C / C ++

4 ★ | 2 Vote

May be interested

  • Things you didn't know about 26 types of Pokeball - Part 2Things you didn't know about 26 types of Pokeball - Part 2
    to be able to catch pokemon, players need to use pokeball. the higher the ball, the higher the success rate of pokemon
  • Stardust's effective way in Pokemon GOStardust's effective way in Pokemon GO
    pokemon go stardust is used to evolve pokemom with candy. therefore, if there is more stardust, it will make the evolution easier.
  • AZ word about eggs in Pokemon GoAZ word about eggs in Pokemon Go
    there are many different pokemon eggs that can hatch into many pokemon, but to make these eggs hatch into pokemon, you will have to perform some tasks. each player begins with an egg incubator, which allows the user to incubate an egg after performing certain steps, gps and pedometer tracking on the mobile device of you and the game.
  • Things you didn't know about 26 types of Pokéball - Part 1Things you didn't know about 26 types of Pokéball - Part 1
    pokéball is the most important item in pokémon go, allowing gamers to quickly catch pokémon back to their team. the higher the pokéball, the more effective the ability to catch pokémon.
  • 10 tips to help you become a great Pokemon trainer10 tips to help you become a great Pokemon trainer
    in the article below, tipsmake.com will introduce to you some tips to easily become a great trainer in this pokemon go game offline ...
  • How to use GoChat application in Pokémon GOHow to use GoChat application in Pokémon GO
    pokémon go has become a very hot phenomenon since its debut. any information or tricks related to the game are read and applied by players during the process of catching pokémon. and the gochat chat app for pokémon go players brings space to capture pokémon much more interesting.
  • How to play Pokemon GO in Landscape Mode on the iPhoneHow to play Pokemon GO in Landscape Mode on the iPhone
    although players can play pokemon go in portrait mode. however, if you want to watch and play games on a large and eye-catching screen, players can switch to playing games in landscape mode.
  • The secret to controlling Pokemon Go employees at workThe secret to controlling Pokemon Go employees at work
    these days, hr managers are faced with an extremely painful problem that is the status of priority employees playing pokemon go more than work. this has caused a small impact on productivity and efficiency.
  • Check out the 'buffalo' Pokémon in Pokémon GoCheck out the 'buffalo' Pokémon in Pokémon Go
    each type of pokemon has hp, cp, ability to attack and endure differently. based on these indicators, players can determine as well as choosing the most powerful pokemon for their offensive tactics.
  • Sitting home can also locate Pokemon around, do you believe it?Sitting home can also locate Pokemon around, do you believe it?
    the tightening of the niantic developers' rules to prevent players from abusing the support tools also brings annoyance, such as those who have no conditions to move much, go away, it is hard to know. get the location of the pokemon around the area they live in