This is not a programming forum, so if my question isn’t relevant, throw me out.
For a CYOA in C, I need a page() function, which returns a function of the same type. The easiest way is to use a void pointer on a function, but the warnings start Vogon poetry (with the option -pedantic for gcc):
to compile: gcc -Wall -W -pedantic -std=c99 test.c -otest
This is exactly the answer to the question I was asking myself, and I couldn’t find it on the internet. All the examples I found never addressed the issue head-on. I’ll look at it; thank you.
Here you declare that page is a pointer to a function that returns void. But your functions don’t return void.
Of the two examples in the FAQ, the second is probably the easiest to wrap one’s head around. Represent the page by a struct, with a function pointer inside.
Yes, but now if I replace in my second example, and in the main() function, pt=pf() by pt = (page (*)()) pf(); I have no more warnings!
Don’t ask me why, this is the kind of little exercise to solve, technical and intellectual, that you must like but that I don’t want to have to do! I’ve tried so many things I don’t understand it anymore.