This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to use function pointer array???

Hi All

I have use function pointer array like this

main.c
uchar i;
for(i = 0;i<END_COMMAND;i++)
printf("%bu %x\n",i,Func_table[i]);

cmd.h

typedef void (*Func) (void);
void init_func(void);
void reset_func(void);
void end_command(void);

cmd.c

Func Func_Table[] =
{
init_func,
reset_func,
end_command
}

void init_func(void){DO_SOMETHING}
void reset_func(void){DO_SOMETHING}
void end_command(void){DO_SOMETHING}

When I run in Keil IDE Debug mode
it can trace into code and print correct
function address (Ex 0 ff00 1 ff10 2 ff20)
,but when I run into flash,all function address is print zero(ex 0 0 1 0 2 0)
so I got reset when use this Func_Table
why??

Thanks a lot