Answer the question
In order to leave comments, you need to log in
How to split short int (from 0 to 65535) into two char numbers (from zero to 255)?
In theory, the maximum number of short int is 2 ^ 16, that is, it can be divided into two char (2 ^ 8), but I still do not understand how to do this. Healthelp
Answer the question
In order to leave comments, you need to log in
bit operations. Something like this:
short int x = 0x6543;
char a = x & 0xff;
char b = (x & 0xff00) >> 8;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question