This first typedef
typedef void (myType)(void);
provides myType as a synonym for type void (void) , a type of function that takes no arguments and returns void . The brackets around myType not really needed; you can also write
typedef void myType(void);
to clarify that this is the type of function that takes void and returns void . Note: you cannot actually declare any type variables of a function; the only way to get an object of type function in C is to define the actual function.
Second typedef
typedef myType *myTypePtr;
then says that myTypePtr is of type equal to a pointer to myType , which means that it is a pointer to a function that takes no arguments and returns void . This new type is equivalent to the void (*)(void) , but is done a little indirectly.
As for your second mistake, I canβt say for sure that without too much context. Please post a minimal test case so that we can see what causes the error.
Hope this helps!
source share