问题
单项选择题
设有以下函数 void fun(int n, char *s) {…} 则下面对函数指针的定义和赋值均正确的是
A.void(*pf)(); pf=fun;
B.viod *pf(); pf=fun;
C.void *pf(); *pf=fun;
D.void(*pf)(int, char); pf=&fun;
答案
参考答案:A
解析: 选项B、C中的pf定义的不是可指向函数的指针。对于选项D,赋值时fun前不应有&。