两种使用函数指针的方法有什么区别?

时间:2013-12-31 02:21:30

标签: c

我已经解决了使用函数指针

的问题
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之间的区别?

谢谢。

0 个答案:

没有答案