name, p->sex, p->age, p->height) struct person*ptr, per[3]=("#5", F, 20, 180.4)" />
#include struct person nar name[20]; float height void output( struct person*p) printf("%o-5s%3c%7d%8.1f", p->name, p->sex, p->age, p->height) printf("\n") void maino struct person*ptr, per[3]=(("#a4" F, 20, 180.4) "李凡",F19,168.2} "任丽",M,20.,174} perper printf(人员信息如下:Ⅶn printf(“姓名性别年龄身高:Ⅶn”); for( ptr<per+3: ptr++)output(ptr) *结构体指针作函参*
#include struct person { char name[20]; char sex; int age; float height; }; void output(struct person*p) { printf("%-5s%3c%7d%8.1f",p->name,p->sex,p->age,p->height); printf("\n"); } void main() { struct person *ptr,per[3]={{"韩华",'F',20,180.4}, {"李凡",'F',19,168.2}, {"任丽",'M',20,174}}; ptr=per; printf(“人员信息如下:\n”); printf(“姓名 性别 年龄 身高:\n”); for(;ptr<per+3;ptr++) output(ptr); /*结构体指针作函参*/ }