Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
int (*ptFunction) (float,char,char);
字符函数(浮点数,字符,字符);
如果我们像上面两个函数声明那样使用不同的返回类型,下面的赋值会正常工作还是会产生编译错误?
ptFunction = &func;
以下代码引发错误(在 g++ 中):
int (*pFun)(float, char, char); char fun1(float, char, char) {} int main() { pFun = &fun1; // error: invalid conversion from char (*)(float, char, char) to int (*)(float, char, char) return 0; }