填空题
建立并输出100个同学的通讯录,每个通讯录包括同学的姓名、地址、邮政编码。
#include
#define N 100
struct communication
{char name[20];
char address[80];
long int post_code;
}commun[N];
main()
{int i;
for(i=0; i<100; i++)
{set_record(commun+i);
print_record(commun+i);
}
}
set_record(struct communication *p)
{printf(“Set a communication record/n”);
scanf(“/%s /%s /%ld”, 1, p->address, 2);
}
print_record ( 3 p)
{printf(“Print a communication record/n”);
printf(“Name: /%s/n”, p->name);
printf(“Address: /%s/n”, p->address);
printf(“Post_code: /%ld/n”, 4);
}
【正确答案】
1、p->name, &p->post_code, struct communication *, p->post_code
【答案解析】