Struct with pointer to a function

Posted by user354021 on Stack Overflow See other posts from Stack Overflow or by user354021
Published on 2010-05-30T14:27:46Z Indexed on 2010/05/30 14:32 UTC
Read the original article Hit count: 165

Filed under:
|
|
|

Hello,

In a C struct I have defined a function pointer as follows:

typedef struct _sequence_t
{
  const int seq[3];
  typedef void (* callbackPtr)();
} sequence_t;

I want to initialize a var of that type globally with:

sequence_t sequences[] = {
  { { 0, 1, 2 }, toggleArmament },
};

And I keep getting error telling me that there are too many initializers. How to work it out?

© Stack Overflow or respective owner

Related posts about c

    Related posts about function