"I don't think it's C" is not equivalent with "it is not C".
Thanks for the link, @Kninnug -- this is a horrible C99 feature (and a GNU extension to C90), and the code has an error: it is a misspelled initialization of an array of three function pointers. I could imagine the fixed code like this:
#define ABC 3
#define A 0
#define B 1
#define C 2
void function1(int *i)
{
}
void function2(int *i)
{
}
void function3(int *i)
{
}
int main(int argc, char *argv[])
{
void (*foo[ABC]) (int *i) = {
[A] = function1,
[B] = function2,
[C] = function3
};
return 0;
}
This compiles.
Also:
What is the value of foo[D]? Is it a null pointer?
Well, what's D? If D >= ABC (assuming that they both are non-negative integers), then that element doesn't even exist. If D < ABC, then it is a NULL pointer, since aggregate (structure, union and array) initialization implicitly zero-initializes elements that have no corresponding initializer expression in the initializer list.
(More precisely, they are initialized "as if they had static storage duration", which is initialization to NULL in the case of pointers.)