This may be accomplished by wrapper functions as per my example below.

#define ON_A 0
#define ON_B 1

function* pFunctions[2]; //pointer to an array of size 2
function pFunction(function*); //a function pointer to a function accepting a function pointer

function SetOnA(function* pFunction)
{
on_a = pFunction; //indirectly set on_a
}

function SetOnB(function* pFunction)
{
on_b = pFunction; //indirectly set on_b
}

function BeepOnce()
{
beep();
}

function BeepTwice()
{
beep();
beep();
}

function main()
{
//Assign functions to the array.
pFunctions[ON_A]=SetOnA;
pFunctions[ON_B]=SetOnB;

pFunction = pFunctions[ON_A];
pFunction(BeepOnce);//set pointer to our OnSetA wrapper function;

//Uncomment to see that this works too.
//pFunction = pFunctions[ON_B];
//pFunction(BeepOnce);//set pointer to our OnSetB wrapper function;

}


Chaos is a paradox consistently inconsistent.