Hi
This is kind of a noob C question although I'm not really one anymore.
I have this simple function which processes a button press:
where "actions" is an array of function pointers of an event to send upon a button press. All the code I listed in the function is new (except executing the event); I just put it there, but I get an error: "invalid use of void expression"
But, why is it null? I cast it.
Button type looks like this:
This is kind of a noob C question although I'm not really one anymore.
I have this simple function which processes a button press:
Code:
void ButtonAction( Button *button, Mode mode )
{
Button *b = (Button *)((button)->actions[(mode)];
if( mode == RepeatPress ) // some enum val
*(b->actions[RepeatPress]) = EventMultiStepLeft;
//execute
...
}
But, why is it null? I cast it.
Button type looks like this:
Code:
typedef struct
{
VOLATILE UINT32 type ;
VOLATILE UINT32 polarity ;
VOLATILE UINT32 pin ;
VOLATILE void * actions [ NumButtonActions ] ;
} Button ;
Comment