Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to convert C++int type into bytes
How to convert C++int type into bytes
The C++int variable is converted to a byte.

C++ is compatible with C language, so the programming of C language is also applicable to c++.

When a variable of type Int becomes a byte, you can use coercion and use the following methods:

int a = 120;

a =(char)a;

Then a will be converted to a Byte type.

It is worth noting that int is a double-byte number. When it becomes single byte, the number of high bytes will be automatically omitted.