I have a C program in which this pointer to function is defined. And i am getting compilation error, what am i doing wrong?
typedef long (*myfunc)(long, long, long, long);
void mytest() {
(*myfunc)(0, 0, 0, 0);
myfunc(0, 0, 0, 0);
}
output from gcc ./test.c
$ gcc ./test.c
./test.c: In function ‘mytest’:
./test.c:106:5: error: expected expression before ‘myfunc’
106 | (*myfunc)(0, 0, 0, 0);
| ^~~~~~
./test.c:107:10: error: expected identifier or ‘(’ before numeric constant
107 | myfunc(0, 0, 0, 0);
| ^
Edit:
compiler version
$ gcc --version
gcc (GCC) 11.3.1 20220421 (Red Hat 11.3.1-3)