我正在使用C++和Linux,遇到了以下问题:
struct testing{
uint8_t a;
uint16_t b;
char c;
int8_t d;
};
testing t;
t.a = 1;
t.b = 6;
t.c = 'c';
t.d = 4;
cout << "Value of t.a >>" << t.a << endl;
cout << "Value of t.b >>" << t.b << endl;
cout << "Value of t.c >>" << t.c << endl;
cout << "Value of t.d >>" << t.d << endl;
我的控制台输出是:
Value of t.a >>
Value of t.b >>6
Value of t.c >>c
Value of t.d >>
看起来int8_t和uint8_t类型缺少t.a和t.d。为什么会这样?
谢谢。
<< unsigned(t.a) <<
和<< unsigned(t.b) <<
。 - T.E.D.