#include
typedef int (*func)(int ,int);
struct mystruct
{
int a;
int b;
func foo;
};
int function(int a,int b)
{
return a+b;
}
struct mystruct myobject=
{
.a =1,
.b =2, //加点表示对特定的成员变量赋值
.foo=function
};
int main(void)
{
printf("%d\n",myobject.foo(myobject.a,myobject.b));
return 0;
}
阅读(2192) | 评论(0) | 转发(1) |