#include
#include
#include
#include
#define MAXSIZE 1000
typedef struct bao
{
int c;
int a;
char b;
}bao;
typedef struct min
{
int c;
int a;
char b;
}min;
void main()
{
char *tData;
struct min *w;
struct min u;
struct bao q;
struct bao *p;
p=&q;
w=&u;
q.a =100;
q.b ='a';
q.c =125;
u.a =56;
u.b ='c';
u.c =11;
tData = (char*)malloc((unsigned int)(MAXSIZE)*sizeof(char));
memcpy(tData,(char*)p,sizeof(bao));
printf("%d\n",sizeof(bao));
printf("%d,%d,%d,%d,%d,%d\n",tData[0],tData[1],tData[2],tData[3],tData[4],tData[5]);
printf("%d,%d,%d,%d,%d,%d\n",tData[6],tData[7],tData[8],tData[9],tData[10],tData[11]);
printf("%c\n",tData[8]);
memcpy((char*)w,tData,sizeof(bao));
printf("%d\n",w->a);
printf("%d\n",w->c);
free(tData);
}
阅读(6552) | 评论(0) | 转发(0) |