#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct TEST1
{
char a;
short b;
int c;
char d;
};
int main()
{
struct TEST1 test1;
char tmp[10];
char buf[100];
char i;
printf("------------------\r\n");
printf("sizeof(test1) = %d\r\n", sizeof(test1));
test1.a = 0x11;
test1.b = 0x1203;
test1.c = 0x13243567;
test1.d = 0x11;
memcpy(buf, &test1, sizeof(test1));
for(i=0;i<sizeof(test1);i++)
{
printf("buf[%d] = %x\r\n", i, buf[i]);
}
printf("------------------\r\n");
return 0;
}