#include
using namespace std;
struct Test
{
int b;
int a;
char ch;
};
int main()
{
Test mytest;
mytest.a = 111;
mytest.b = 222;
mytest.ch = ‘A’;
int a = *(int *)((unsigned char *)&mytest + sizeof(int));
cout << a << endl;//a=222,this value is related to the order of declaration
char ch = *(char *)((unsigned char *)&mytest + sizeof(int)*2);
cout << ch << endl;//ch='A'
cout << "--------------------" << endl;
int *b = (int *)((unsigned char *)&mytest);
cout << *b << endl;
int *ap = (int *)(b + 1);
cout << *ap << endl;
char *cp = (char *)(ap + 1);
cout << *cp << endl;
system("pause");
return 0;
}