How to pass function names as parameter?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux