//姓名别用char指针来保持,不然就复杂了
#include <stdio.h>
int main()
{
struct Person
{
char name[10];
int age;
} ;
struct Person person[2];
printf("please input:");
for (int i=0; i<2; i++)
{
scanf("%s%d", person.name,&person.age );
printf("第%d个结构体数组:name = %s, age = %d\n", i, person.name,person.age);
} |