This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
How to pass function names as parameter?
- From: Walter Kasberg <Walter dot Kasberg at web dot de>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 28 Feb 2007 18:58:03 +0100
- Subject: How to pass function names as parameter?
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