在学习驱动开发的时候看到下面这种代码
typedef NTSTATUS DRIVER_INITIALIZE ( _In_ struct _DRIVER_OBJECT *DriverObject, _In_ PUNICODE_STRING RegistryPath );
一开始看感觉很奇怪,不知道为啥前面要加一个typedef,后来网上搜了搜,看到下面这个问答
https://stackoverflow.com/questions/4295432/typedef-function-pointer
顿时就明白怎么回事了,我来自己举个例子
#includetypedef int myfunc(int a); myfunc b; int main() { printf("%dn", b(123)); return 0; } int b(int a) { return a; }