   C Function Pointer Error
  I'm trying to create a simple C structure that contains a function pointer. This function should take a single parameter which is the type of the structure. For the life of me I cannot figure it out. My compiler keeps telling me there is a "parse error before '*' token" on the line where I declare my function pointer. I know it's the parameter because if I change BasicButton to an int, it works fine. Any ideas? Here's the source:struct BasicButton;typedef struct{cpShape *shape1;cpShape *shape2;int hasBeenTriggered;int (*fire)(BasicButton*);int removeOnFire;} BasicButton;
  I'm not sure about this, but it might work.typedef struct BASICBUTTON{cpShape *shape1;cpShape *shape2;int hasBeenTriggered;int (*fire)(BASICBUTTON*);int removeOnFire;} BasicButton;;  Thanks for the try, but that gives the same error.   ;  Actually, it's a bit worse than that.typedef struct Self{cpShape *shape1;cpShape *shape2;int hasBeenTriggered;int (*fire)(struct Self*);int removeOnFire;} BasicButton;;  In C, structs must be prefixed by "struct," even when declaring an instance of that struct type; this is why that "typedef struct {} T;" junk is neccessary. Since, in the scope of your struct definition, your typedef is not visible, you must still prefix the BasicButton.The forward declaration is not strictly required; you can name the struct as Antheus suggested instead (personally, I find that more compact):typedef struct BasicButtonType{  cpShape *shape1;  cpShape *shape2;  int hasBeenTriggered;  int (*fire)(struct BasicButtonType*);  int removeOnFire;} BasicButton;;  Thanks. Worked like a charm.   