我已经解决了使用函数指针
的问题typedef int (*zly)(int,int);
struct fuc{
zly name;
};
int zzc(int a,int b){
return b - a;
}
int mfc(zly z,int a,int b){
return z(a,b);
//return (*z)(a,b);
}
int main(){
struct fuc *s = malloc(sizeof(struct fuc));
//s->name = &zzc;
s->name = zzc;
int res = mfc(s->name, 5,10);
printf("%d\n",res);
// two has same address.
printf("%x -- %x \n",&zzc,zzc);
}
我想知道s-> name =& zzc和s-> name = zzc之间的区别?
谢谢。