Once again today with renaming.
The structure has a pointer to a function, in this function I want to work with data from this structure, so the pointer to the structure is indicated as a parameter.
Demonstration of this problem
#include <stdio.h>
#include <stdlib.h>
struct tMYSTRUCTURE;
typedef struct{
int myint;
void (* pCallback)(struct tMYSTRUCTURE *mystructure);
}tMYSTRUCTURE;
void hello(struct tMYSTRUCTURE *mystructure){
puts("!!!Hello World!!!");
}
int main(void) {
tMYSTRUCTURE mystruct;
mystruct.pCallback = hello;
mystruct.pCallback(&mystruct);
return EXIT_SUCCESS;
}
But I get a warning
.. \ src \ retyping.c: 31: 5: warning: passing argument 1 from 'mystruct.pCallback' from an incompatible pointer type .. \ src \ retyping.c: 31: 5: note: expected 'struct tMYSTRUCTURE *', but the argument is of type 'struct tMYSTRUCTURE *'
the expected 'structure tMYSTRUCTURE *', but this is 'struct tMYSTRUCTURE *', ridiculous!
any idea how to fix it?