how would i go about having a function pointer within a struct?
i've gotten this far and it seems to work but the function doesnt seem to be getting called:
struct Page {
char* title;
...
void (*out)(const char*);
}
void out(const char* str) {
printf("%s\n",str);
}
struct Page* pg;
pg->out=out;
pg->out("Hello"
i've gotten this far and it seems to work but the function doesnt seem to be getting called:
struct Page {
char* title;
...
void (*out)(const char*);
}
void out(const char* str) {
printf("%s\n",str);
}
struct Page* pg;
pg->out=out;
pg->out("Hello"