I have a struct with a function pointer, that is intended for pointing to the bar() function, but i have no clue how to call the function that's being pointed on:
#include <stdlib.h>
typedef struct Foo
{
int (*func_ptr)(const char *, const char *);
} Foo;
int bar(const char *a, const char *b)
{
return 3;
}
int main(void)
{
Foo *foo = (Foo *)malloc(sizeof(Foo));
foo->func_ptr = &bar;
//how do i call the function?
return 0;
}