I have countered a problem about use function pointer
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);
}
I want to know the difference between s->name = &zzc and s->name = zzc ?
Thank you .