#include <stdio.h> //结构体类似于java里的类 struct Student{ int age; char name[10]; int sex; //声明函数指针 int(*fun)(int x,int y); }; int add(int x,int y){ return x+y; } main(){ //相当于初始化 struct Student st = {12,"zzz",1}; //把这个指针进行赋值 st.fun = add; printf("学生的姓名是%s",st.name); printf("学生会加法%d",st.fun(1,2)); system("pause"); }