Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to distinguish int, byte and short in C++
How to distinguish int, byte and short in C++
Int occupies a machine word length. In the 32-bit system, int occupies 32 bits, that is, 4 bytes, while in the old 16-bit system, int occupies 16 bits, that is, 2 bytes. However, in the C++ standard, only the limited short is fixed at 2 bytes, the long is fixed at 4 bytes, and the int is indefinite, which can be short (such as TC) or long (such as VC). Int: By default, it is signed and interchangeable. Char: How many bytes do most Chars occupy in Visual C++6.0? Int, long: 32 bits = 4 bytes short, 16 bits = 2 bytes. Type the code printf("%d, %d, %d "), which is related to the word length of the machine. In 16 bit machine, int is 2 bytes, and in 32 bit machine, it is 4 bytes, which is required by C/C++ standard. = int>= short & gt= char WORD, DWORD, BYTE and byte are the data types involved in reading windows programs. It may be int x, n in C++; n = sizeof(x); The value of n is the result. The C++ standard that variables occupy bytes in memory only stipulates that the number of bytes occupied by int type data is not more than long type and not less than short type. What you said is that int and long are the same on a 32-bit machine, both of which are 32 bits. The following is a description of scanf ("%d %ld% LD",&; 1. & b) What about the numbers A and B in b)? Please give an example! Short int signed 2 bytes short plastic-32768 ~ 32767 unsigned int unsigned 4 bytes can be seen that the value range of byte and short is relatively small, while the value range of long is too large, which takes up a lot of space, basically int can meet our daily calculation, and int is also the most used integer type.