A
aruna.mysore
Hi all,
I have a specific problem passing a function pointer array as a
parameter to a function. I am trying to use a function which takes a
function pointer array as an argument. I am too sure about the syntax
of calling the same.
#include <stdio.h>
void fp1()
{ printf("In fp1\n"); }
void fp2()
{ printf("In fp2\n");}
void fp3()
{ printf("In fp3\n");}
void call_fpn(void (*fp[3])())
{
(*fp[0])();
(*fp[1])();
(*fp[2])();
}
void main()
{
void (*pfn[3])()={NULL};
pfn[0]=&fp1;
pfn[1]=&fp2;
pfn[2]=&fp3;
call_fpn(.....);
}
Can someone please let me know what is the right syntax for calling
the function accepting a function pointer array.
Thanks in advance.
Ar
I have a specific problem passing a function pointer array as a
parameter to a function. I am trying to use a function which takes a
function pointer array as an argument. I am too sure about the syntax
of calling the same.
#include <stdio.h>
void fp1()
{ printf("In fp1\n"); }
void fp2()
{ printf("In fp2\n");}
void fp3()
{ printf("In fp3\n");}
void call_fpn(void (*fp[3])())
{
(*fp[0])();
(*fp[1])();
(*fp[2])();
}
void main()
{
void (*pfn[3])()={NULL};
pfn[0]=&fp1;
pfn[1]=&fp2;
pfn[2]=&fp3;
call_fpn(.....);
}
Can someone please let me know what is the right syntax for calling
the function accepting a function pointer array.
Thanks in advance.
Ar