小编Ank*_*kit的帖子

是否有替代语法来设置typedef函数指针?

为了做一个函数指针的typedef,我们做这样的事情,

typedef int (*func) (char*);
typedef struct{
  char * name;
  func f1; 
}
Run Code Online (Sandbox Code Playgroud)

与此相反,我遇到了一个我不明白的代码.

typedef int rl_icpfunc_t (char *);
typedef struct {
   char *name;         /* User printable name of the function. */
   rl_icpfunc_t *func; /* Function to call to do the job. */
   char *doc;          /* Documentation for this function.  */
}COMMAND;
Run Code Online (Sandbox Code Playgroud)

这是libedit库示例的代码片段.有人可以向我解释一下吗?

c typedef function-pointers

6
推荐指数
1
解决办法
186
查看次数

标签 统计

c ×1

function-pointers ×1

typedef ×1