C
Charles Sullivan
I define and initialize an array of structures like the following,
(where the <verbiage within angle brackets> is just meant to be
explanatory):
int func1(<argument prototypes>);
int func2(<argument prototypes>);
struct mystruct {
<other stuff>;
int (*myfunc)();
} myrecords[] = {
{<other stuff value>, func1},
{<other stuff value>, NULL },
{<other stuff value>, func2}
};
int func1(<argument list>)
{
<blah-blah-blah1>
}
int func2(<argument list>)
{
<blah-blah-blah2>
}
I've always believed this was legal code, and have used something
similar a few times in the past, but now when (<argument list>) is:
(unsigned char x1, unsigned char x2, unsigned char x3,
int *y1, unsigned int *y2, int *y3)
I get the compiler message:
"warning: initialization from incompatible pointer type"
What am I doing wrong?
Thanks for your help.
Regards,
Charles Sullivan
(where the <verbiage within angle brackets> is just meant to be
explanatory):
int func1(<argument prototypes>);
int func2(<argument prototypes>);
struct mystruct {
<other stuff>;
int (*myfunc)();
} myrecords[] = {
{<other stuff value>, func1},
{<other stuff value>, NULL },
{<other stuff value>, func2}
};
int func1(<argument list>)
{
<blah-blah-blah1>
}
int func2(<argument list>)
{
<blah-blah-blah2>
}
I've always believed this was legal code, and have used something
similar a few times in the past, but now when (<argument list>) is:
(unsigned char x1, unsigned char x2, unsigned char x3,
int *y1, unsigned int *y2, int *y3)
I get the compiler message:
"warning: initialization from incompatible pointer type"
What am I doing wrong?
Thanks for your help.
Regards,
Charles Sullivan