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 ++:
- signed (signed)
- unsigned (no sign)
- long
- 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 ++
You should read it
- How to remap Modifier Key on iPad
- How to transfer unsigned text with Unikey
- How to convert Vietnamese accented into unsigned very fast like Unikey
- Access Modifier for class in C ++
- How to Install Software from Unsigned Developers on a Mac
- Function strtoul () in C
- How to fix Vietnamese typing error on Skype
- How to turn Caps Lock keys into modifier keys on Mac
- How to install the driver has not been Signed on Windows 10
- The hacker 'World Cup' season
- Giraffes have a long neck not to eat leaves on the tops of trees?
- How to fix the long path of the directory path on Windows