If the array does not have static storage duration then the operator can be used as an initializer expression.
From the C Standard (6.7.9 Initialization)
4 All the expressions in an initializer for an object that has static
or thread storage duration shall be constant expressions or string
literals.
Take into account that you may not declare an array of functions but you may declare an array of pointers to functions.
Here is a demonstrative program
#include <stdio.h>
void f( void ) { puts( "f"); }
void g( void ) { puts( "g"); }
int main(void)
{
int x = 1, y = 2;
void ( *fp[] )( void ) = { x < y ? f : g };
fp[0]();
return 0;
}
The program output is
f
If a function type is too complicated you can introduce a typedef for it. For example
#include <stdio.h>
void f( void ) { puts( "f"); }
void g( void ) { puts( "g"); }
int main(void)
{
int x = 1, y = 2;
typedef void F( void );
F * fp[] = { x < y ? f : g };
fp[0]();
return 0;
}
You can use the conditional operator to initialize an array with static storage duration. The problem is that the condition must be a constant expression that is not always suitable. For example
#include <stdio.h>
void f( void ) { puts( "f"); }
void g( void ) { puts( "g"); }
typedef void F( void );
F * fp[] = { 1 ? &f : &g };
int main(void)
{
fp[0]();
return 0;
}
From the C Standard (6.6 Constant expressions)
9 An address constant is a null pointer, a pointer to an lvalue
designating an object of static storage duration, or a pointer to a
function designator; it shall be created explicitly using the
unary & operator or an integer constant cast to pointer type, or
implicitly by the use of an expression of array or function type. The
array-subscript [] and member-access . and -> operators, the address &
and indirection * unary operators, and pointer casts may be used in
the creation of an address constant, but the value of an object shall
not be accessed by use of these operators.