I have ver 3.232 of PCH. are function pointers supported?
if so what is the proper declaration of such in CCS. any examples would surely be appreciated.
int test_func1(void)
{
int j=0;
return j;
}
int test_func2(void)
{
int j=1;
return j;
}
main()
{
int x;
int (*f1)(void);
int (*f2)(void);
f1=test_func1;
f2=test_func2;
//would a call to either one of these would be
x=(*f1)(void)
}
this will not compile. I want to place the entry point of test_func1 into pointer f1 and so on. I have never used function pointers before and I am
completely confused.
thanks
MikeValencia
Joined: 04 Aug 2004 Posts: 238 Location: Chicago
Posted: Tue Oct 25, 2005 9:52 am
From the FAQ list on the website:
Quote:
How do I make a pointer to a function?
See EX_QSORT.C for an example.
There was once a time when I used function pointers for a state machine. With CCS, to make a state machine, I just use switch-case statements.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum