【发布时间】:2015-11-11 00:15:06
【问题描述】:
为了给函数指针做 typedef,我们做这样的事情,
typedef int (*func) (char*);
typedef struct{
char * name;
func f1;
}
与此相反,我遇到了一个我不明白的代码。
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;
这是来自 libedit 库示例的代码 sn-p。有人可以向我解释一下吗?
【问题讨论】:
-
它是一个带char*参数的int函数。
标签: c function-pointers typedef