带指针参数的函数指针数组

来源:互联网 发布:手机基站测试软件 编辑:程序博客网 时间:2024/06/02 04:15

#include"stdio.h"
void display(struct student*);
void display1(struct student*);
void display2(struct student*);
struct student
{
int num;
int age;
};
void main()
{
struct student *stu,sd;
sd.age=20;
sd.num=30;
stu=&sd;
void (*a[3])(struct student*)={display,display1,display2};
 (*a[1])(stu);
}
void display(struct student *a)
{
printf("%d",a->age);

}
void display1(struct student *b )
{
printf("%d",b->age);
}
void display2(struct student *c)
{
printf("%d",c->age);
}

 

0 0
原创粉丝点击