0

i have the following class:

class A
{
public:
    static void (*callbacks[6])();
};

And i need to initialize all values of callbacks, to NULL.

How is that done?

I have tried the following:

void (* )[6]() A::callbacks[6] = {
    NULL, NULL, NULL, NULL, NULL, NULL
};

But doesn't works

4

2 回答 2

4

The syntax for your definition is wrong.

Change

void (* )[6]() A::callbacks[6]

to

void (*A::callbacks[6])()
于 2013-03-30T20:09:46.943 回答
1
typedef void(*T)();
T A::callbacks[6] = {NULL,NULL,NULL,NULL,NULL,NULL};
于 2013-03-30T20:09:40.270 回答