// t.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include<iostream>
using namespace std;
union
{
int i;
char x[2];
}a;
int _tmain(int argc, _TCHAR* argv[])
{
a.x[0]=10;
a.x[1]=1;// 0x01 0x0A==266
cout<<a.i<<endl;
while(1);
return 0;
}
// t.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include<iostream>
using namespace std;
union
{
char ch;
int i;
char x[2];
long double k;
double j;
long int a;
}a;
int _tmain(int argc, _TCHAR* argv[])
{
cout<<sizeof(a)<<endl;
while(1);
return 0;
}