Wednesday, October 28, 2009

Simple Function Pointer

Simple Function Pointer Program - C++

#include <iostream>

using std::cout;
using std::endl;

void fun (void) {
cout<<"hello function"<<endl;
}

typedef void (*myfun)(void);

int main() {
myfun foo;

foo = &fun;
(*foo)();
cout<<"hello world"<<endl;
return 0;
}

No comments: