69,336
社区成员
发帖
与我相关
我的任务
分享
typedef int delete_dir_cb( char* path, int action, int succ); //函数类型
typedef int (*delet_dir_cb)( char* path, int action, int succ);//函数类型指针
参见下面C99标准描述:
typedef int F(void); // type F is ‘‘function with no parameters
// returning int’’
EXAMPLE 4 On the other hand, typedef names can be used to improve code readability. All three of the following declarations of the signal function specify exactly the same type, the first without making use of any typedef names.
typedef void fv(int), (*pfv)(int);
void (*signal(int, void (*)(int)))(int);
fv *signal(int, fv *);
pfv signal(int, pfv);
#include <stdio.h>
typedef int delete_dir_cb( char* path, int action, int succ);
typedef int (*delete_dir_cb2(char *path, int action, int succ);
int main(int argc, char *argv[])
{
delete_dir_cb num;
delete_dir_cb2 num2;
printf("sizeof(num) = %d\n", sizeof(num));
printf("sizeof(num2) = %d\n", sizeof(num2));
return 0;
}