function pointer problem
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-06-26 4:27 AM
Posted on June 26, 2015 at 13:27
hi
Im using keil developing on a stm32f4 discovery board. im trying to make a function pointer to be used by other modules. something like: extern void (*p)() ; void myfunc() { printf(''function pointer''); } somefunction(struct Adc *instance) { p = myfunc(); } i get the following error at the ''p = myfunc();''-line: error: &sharp513: a value of type ''void'' cannot be assigned to an entity of type ''void (*)(void)'' know this is prob a noob question - but ive tried finding a solution - but cannot seem to solve it. can any1 tell me waht im doing wrong? thanks in advance #513
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-06-26 6:37 AM
Posted on June 26, 2015 at 15:37
You're trying to assign the pointer, not call the function
p = myfunc;
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
