Ok, I've hacked together a general on_anykey function which captures the scancode and resolves them via the key_mapping array. Anyway, here is what you were probably already thinking. As such I see no need for a struct at this time.

P.S. You have KB_C defined twice, once for the c key and once for the comma key. I changed it to KB_COMMA.


Implementation:

//Test Functions:
function BeepOnce()
{
beep();
}

function BeepTwice()
{
beep();
beep();
}
//End Test Functions

void gpFunction();//global function pointer

//function to handle input
function processInput(scancode)
{
gpFunction=key_map[scancode];
gpFunction();
}

function main()
{
map_key(KB_B, BeepOnce);
map_key(KB_C, BeepTwice);

on_anykey = processInput;
}


Chaos is a paradox consistently inconsistent.