话不多说,直接上代码。
#include <iostream>
using namespace std;
int main()
{
unsigned int *data = new unsigned;
unsigned char *byte;
*data = 0x000000ff;
cout<<*data<<endl;
byte = (unsigned char *)data;
//低位存储在低地址
for(int i=0;i<4;++i)
{
cout<<(int)(*(byte+i))<<endl;
}
system("pause");
return 0;
}
运行结果: