I'm using C++ to parse binary data from files. Each byte gets stored in a char array, at least when working from cplusplus.com's example. The issue here is that my data source uses 24-bit values, so bytes have to be combined.
Here is a very simple example. The desired output is AABB but the actual output is 165 due to it doing addition.
#include <iostream>
using namespace std;
int main() {
unsigned char one = 0xAA;
unsigned char two = 0xBB;
unsigned int sum = one + two;
cout << hex << sum << "\n";
return 0;
}