In C
it is not allowed to define a method inside a struct
. You could define a function pointer inside a struct as follows:
typedef struct {
double x, y, z;
struct Point *next;
struct Point *prev;
void (*act)();
} Point;
You will have to assign the pointer to a specific function whenever you instantiate the struct
.