Packing values into a single int
- by user303907
Hello,
Let's say I have a couple of variables like apple, orange, banana
I have 8 apples, 1 orange, 4 bananas.
Is it possible to somehow convert those values into a single integer and also revert back to their original values based on the computed integer value?
I found an example online.
int age, gender, height;
short packed_info;
. . .
//…