【发布时间】:2015-12-03 07:52:55
【问题描述】:
如何从其他函数调用的函数中获取返回值?
int plus(int a, int b) { return a+b; }
int cal(int (*f)(int, int)) { // Does it correct?
int ret;
// how can I get the return value from the function?
return ret;
}
int main() {
int result = cal(plus(1,2)); // I'd like it can be called in this way
return 0;
}
【问题讨论】:
-
int f(void) { return g(); }?请说明您想要完成的任务。
标签: c pointers function-pointers