CodePudding user response:
Sure is like this? Can be used to test the programCodePudding user response:
#include
#include
The union TestType
{
Char mChar [4].
Int mInt;
};
Int main ()
{
TestType test;
Test. MChar [3]='F';
Test. MChar [2]='A';
='T' test. MChar [1];
Test. MChar [0]='E';
Char t=static_cast & lt; char> (test. MInt);
Printf (" % % % % c, c, c, c/n ", the test. The mChar [3], the test. The mChar [2], the test. The mChar [1], the test. The mChar [0]).
Printf (" % % % % c, c, c, c/n ", (test. MInt> 24) % 256, (test. MInt> 16) % 256, (test. MInt> 8) % 256, test. MInt % 256);
Printf (" % \ n "c, t);
}
CodePudding user response:
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.htmlI hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html