Once again today with retyping..
In structure is pointer to function, in this function I want to be able work with data from this structure, so the pointer to structure is given as parameter.
Demo 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!!!"); /* prints !!!Hello World!!! */
}
int main(void) {
tMYSTRUCTURE mystruct;
mystruct.pCallback = hello;
mystruct.pCallback(&mystruct);
return EXIT_SUCCESS;
}
But I get Warning
..\src\retyping.c:31:5: warning: passing argument 1 of 'mystruct.pCallback' from incompatible pointer type ..\src\retyping.c:31:5: note: expected 'struct tMYSTRUCTURE *' but argument is of type 'struct tMYSTRUCTURE *'
expected 'struct tMYSTRUCTURE *' but is 'struct tMYSTRUCTURE *', funny!
any Idea how to fix it?