Returning function pointer type

前端 未结 7 1919
心在旅途
心在旅途 2020-11-29 20:08

Often I find the need to write functions which return function pointers. Whenever I do, the basic format I use is:

typedef int (*function_type)(int,int);

fu         


        
7条回答
  •  有刺的猬
    2020-11-29 20:20

    You can probably do something like:

    int foo (char i) {return i*2;}
    
    int (*return_foo()) (char c)
    {
       return foo;
    }
    

    but god, I hope I'll never have to debug you code....

提交回复
热议问题