I have a struct defined as follow:
typedef struct {
char (*behave) (int*);
} BEHAVIOURSTRUCT;
this struct is defined in a .h file and it is included in the .c file There i have a global variable (MAX_BEHAVIOURS is defined as 3):
BEHAVIOURSTRUCT bhvr[MAX_BEHAVIOURS];
and in the init i try to asign this, but here i get the warning: "assignment from incompatible pointer type"
void init() {
bhvr[0].behave = BHVR_line_follow; // here
...
}
the function i am trying to asign
void BHVR_line_follow(int *currstate){
....
}
by the sound of it my declaration in the struct and the pointer to the function are not from the same build, but in my opinion they are. But most likely i am mistaken.