返回为何不是 ab? 先谢谢啦
那位大侠帮忙看看 返回为何不是 ab?
#include "stdafx.h"
#include <string.h>
main()
{
char x[30]="abcdefhijklmnopqrstuvwxyz";
char *q=x;
struct a
{
char y[2];
char y1[3];
char y2[4];
};
a a1;
memcpy(a1.y,q,sizeof(a1.y));
q=q+1;
memcpy(a1.y1,q,sizeof(a1.y1));
q=q+2;
memcpy(a1.y2,q,sizeof(a1.y2));
printf("%s",a1.y);
getchar();
return 0;
}