我有一个函数,我想将它作为参数传递给另一个函数(我们称之为 funX)。这是 funX 原型:
void funX(const unsigned char *, unsigned char *, size_t, const somestruct *, unsigned char *, const int);
和我的调用 funX 的函数(我们称之为 funY):
unsigned char * funY(unsigned char *in, unsigned char *out, size_t len, unsigned char *i, void *k, int ed, void (*f)(unsigned char *, unsigned char *, size_t, const void *, unsigned char *, const int))
{
f(in, out, len, k, i, ed);
}
但是我在编译时有一些警告:
test.c: In function ‘main’:
test.c:70:5: warning: passing argument 7 of ‘funY’ from incompatible pointer type [enabled by default]
test.c:11:17: note: expected ‘void (*)(unsigned char *, unsigned char *, size_t, const void *, unsigned char *, const int)’ but argument is of type ‘void (*)(const unsigned char *, unsigned char *, size_t, const struct somestruct *, unsigned char *, const int)’