What you want is a callback. Callbacks are implemented in the same way as in C ++:
typedef int (*CallbackType)( char c ); int wrong( CallbackType callback ) { std::cout << "WRONG \n"; int r = callback( 'x' ); return r; } int also_wrong( char c ) { return wrong( also_wrong ); }
Of course, this will lead to a fugitive recursion, so this will cause you a lot of problems, but it definitely answers your question.
And yes, if all he does is return 0 , then this is a function that will be better expressed as returning void .
source share