In C, what is the difference between `&function` and `function` when passed as arguments?

后端 未结 4 1703
醉酒成梦
醉酒成梦 2020-12-05 07:41

For example:

#include 

typedef void (* proto_1)();
typedef void proto_2();

void my_function(int j){
    printf(\"hello from function. I got          


        
4条回答
  •  情书的邮戳
    2020-12-05 08:29

    There is no difference between &function and function - they're both addresses. You can see this by printing them both:

    function bar(); 
    
    .... 
    printf("addr bar is 0x%d\n", &bar);
    printf("bar is 0x%d\n", bar);
    

提交回复
热议问题