Quick question: since int is 2 bytes and char is 1 byte, I want to save the int variable in 2 char variables. (for example, bit 1-8 in the first char, bit 9-16 in the second char). Using C as a programming language.
How can i achieve this? There will be something like:
int i = 30543; char c1 = (char) i; char c2 = (char) (i>>8);
do this job?
I could not find if int listing in char could just reset bit 9-16.
source share