【发布时间】:2014-08-21 21:49:38
【问题描述】:
在function pointers,
如果将函数指针分配给添加函数,为什么(*fptr)(int a, int b)与(fptr)(int a, int b)相同?
int (*fptr)(int ,int) = add;
while add(int a , int b) returns sum of two numbers.
【问题讨论】:
-
请发布正确的代码来演示该问题。你写的是两种不同的类型(一种是函数类型,另一种是函数指针类型)。并且题名与题体不同。
-
现在完全颠覆你的想法:
(****fptr)(6, 7)呢? -
@Ayush:“改进”是一个强词......
-
您不需要取消引用,因为函数和指向函数的指针都作为指针处理。