CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

function pointers

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
eaton



Joined: 02 Oct 2004
Posts: 22
Location: cleveland

View user's profile Send private message Send e-mail

function pointers
PostPosted: Tue Oct 25, 2005 9:08 am     Reply with quote

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

View user's profile Send private message Send e-mail Yahoo Messenger

PostPosted: Tue Oct 25, 2005 9:52 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group