How to pass function names as parameter?
Walter Kasberg
Walter.Kasberg@web.de
Wed Feb 28 18:14:00 GMT 2007
I want to pass function names as parameter to a subroutine.
I made a simple test programm:
-------------------
/* */
#include <stdio.h>
main ()
{
int feins ();
int fzwei ();
int rufen ();
rufen ( feins () );
rufen ( fzwei () );
}
rufen ( der )
int (*der) ();
{
(*der) ();
}
feins ()
{
printf ("\nThat is module eins\n\n");
}
fzwei ()
{
printf ("\nThat is module zwei\n\n");
}
---------------------
The program compiles and links successfully.
But running the program gives an error. the first call 'rufen( feins () )'
calls the
correct function 'feins' and the message there. But then I get 'message access
error'
(as I would translate it).
What could be wrong?
Any hint is appreciated.
Walter
More information about the Gcc-help
mailing list