I am trying to use function pointer, which is somewhat like this:
#include "stdio.h"
typedef void (*func)(int*, int*);
void func1(int *a, int*b)
{
printf("Func1\n");
}
void func2(int *a, int*b)
{
printf("Func2\n");
}
void func3(int *a, int*b)
{
printf("Func3\n");
}
int main()
{
int i;
func f[] = {
func1, func2, func3
};
printf("Hello\n");
for(i=0; i< 3; i++)
{
func fn = f[i];
*(fn)(&i, &i);
}
return 0;
}
I am always getting error: "void value not ignored as it ought to be"
Do not know, how to overcome this. Can anybody please help?
You need to use like following :
(*fn)(&i, &i);
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments