I have a weird problem about working with integers in c++.
I wrote a simple program that sets a value to a variable and then prints it, but it is not working as expected.
My program has only two lines of code:
cout<<"value is "<<aa<<endl;
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
It doesn't really print a blank, but most probably the ASCII character with value 5, which is invisible. There's a number of invisible ASCII character codes, most of them below value 32, which is the blank actually.
You have to convert
unsigned int to output the numeric value, since
ostream& operator<<(ostream&, unsigned char) tries to output the visible character value.
uint8_t aa=5; cout << "value is " << unsigned(aa) << endl;