Friday, October 1, 2010

I have learned how to used function pointer for keep the entry address of the function.
For example:

There are 10 functions.

int fun1(){...}
int fun2(){...}
......
int fun(10){...}


If you want to execute them by order, then you can use the function pointer.

int (*table[10]()) // defined a function pointer array
{
fun1,
....
fun10,
};

for (int i = 0; i< 10; i++)
{
table[i};
}

No comments:

Post a Comment