gpt4 book ai didi

c - 错误: invalid type argument of 'unary *' (have 'int' )|

转载 作者:行者123 更新时间:2023-12-02 20:27:15 27 4
gpt4 key购买 nike

#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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com