I'm trying to store two different chars to a single Int. Upper B and lower B.
Is this method correct and the most efficient?
Code://sizeof Int = 2 Bytes //array of unsigned chars init to hex vals //[1] = 1111 1111 //[0] = 1010 1010 //final Int = c_Array[1] c_Array[0] ...sudo code int function1( *c_Array) { signed int var; var = (int) (c_Array[1] << 8) ; //upper BYTE stored var &= (int) ( c_Array[0] ); //lower BYTE and'd with var return var; } //first should be var = 1111 1111 0000 0000 //second should be var = 1111 1111 1010 1010