Hi, I'm having trouble storing a function pointer in a generic pointer. Apparently I'm causing a screw up in the memory locations for one reason or another.
The program causes a segmentation fault when I attempt to call the function via the new pointer, and when I checked it with a debugger, it was indeed not pointing to the correct place in memory. I'm not sure what I should do to fix the problem, though.
Here is the program:
It's supposed to implement a really basic LIFO data stack.
Here is what my output looks like:
If you want to try to compile this piece of crap (bless your heart), I have a makefile for it that you can download here:Code:./cstackdemo Hello there. 27 Segmentation fault