#include <stdio.h>
int _area(), _vol(), (*fnptr)();// declare the functions and the function pointer here
_area(a,b)
int a, b;
{
return (a*b); //The return value of _area after parameters are passed to it
}
_vol(fnptr,c) //engaging the function pointer as a parameter
int c;
{
fnptr = _area(); //initializing the function pointer to function _area
int k = (*fnptr)(8,9); // error occurs here
return (k*c);
}
编译产生错误,
:error: invalid type argument of 'unary *' (have 'int')
最佳答案
**int k = (*fnptr)(8,9);** should be int **k = (*fnptr)(8,9);
关于c - 错误: invalid type argument of 'unary *' (have 'int' )|,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20608186/