typedef struct s1{
int a;
char c;
char s[20]; // 如果要定义 char* s; 记得动态分配空间
};
typedef struct s2{
int a;
char c;
char s[20];
};
int main()
{
struct s1 x;
struct s2* y;
y = (struct s2*)malloc(sizeof(struct s2));
scanf("%d%c%s%d%c%s", &x.a, &x.c, &x.s, &y->a, &y->c, &y->s);
printf("%d %c %s\n", x.a, x.c, x.s);
printf("%d %c %s\n", y->a, y->c, y->s);
return 0;
}
/*
1ajkl
2bxyz
1 a jkl
2 b xyz
Process returned 0 (0x0) execution time : 10.914 s
Press any key to continue.
*/