pointers to functions
why doesn't this code work?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
#include <iostream>
using namespace std;
char *function()
{
return "lol";
}
char *function2()
{
char *(*me)();
hannes=&function;
return me;
}
int main()
{
char *(*me)();
me=function2();
char *tmp=hannes();
cout<<tmp<<endl;
}
|
- 'hannes' is not declared anywhere
- me = function2();
should be me = function2;
hannes has to be me, and me in the main-function must be the return value of function2
What?
problem is already solved. thanks anyway!
Topic archived. No new replies allowed.