Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - The number of bytes about int in c language
The number of bytes about int in c language
In C language, if a number appears in the code alone, its 0 sizeof(0) will be regarded as an int constant.

So it's 4 bytes,

If it is' 0', this is the English letter, that is, the char type, which should be 1 byte. This is not necessarily because the ASCII-C standard (that is, the C89 standard, the latest is the IOS-C standard) requires that the type should be upgraded to int when dealing with data of character type, but not all compilers abide by this rule. Therefore,  vc6.0 compiler and linux gcc compiler sizeof('0') is 4, and unix-AIX cc compiler sizeof('0') is 1 (I have tried these compilers in these different systems).

In addition, if it is 0.0, it will be a constant of type double by default, and sizeof(0.0) is 8.

Of course, I'm talking about the case of a 32-bit system, and the int type of a 32-bit system is 4 bytes.