[C]结构变量数组array of structure varibles
#include <stdio.h> struct Person { char name[10]; char character[20]; int age; }; int main() { struct Person man[2]; //创建结构变量数组 for (int i = 0; i < 2; i++) //初始化 { puts("enter name: "); scanf("%s", man[i].name); puts("enter character: "); scanf("%s", man[i].character); puts("enter age: "); scanf("%d", &man[i].age); } //输出 puts("\n***display your entered information***"); for (int i = 0; i < 2; i++) printf("My name is %s, I'm %d years old. And my friends always complain I'm so %s.\n", man[i].name, man[i].age, man[i].character); return 0; }