Also, unless I'm off my rocker,
key[ANY_VALID_VALUE_HERE]
will always either evaluate to 0 or 1... since they key[SCAN_CODE] array is used for verifying if the key that the index represents is being pressed.
So that first snippet of code is fundamentally wrong. ditch the key[], and just leave the SCAN_CODE.
Here's an example from my Sully codebase-in-progress:
HookKey( SCAN_F10, "SaveScreenShot" );
HookKey( SCAN_F4, "mcg_print_all" );
These are temporary hookkeys, one to the screenshot function that one of you blokes out there coded (Zip? Ger? I forget offhand), and another to a heavy-duty logging function for debugging purposes.
Any questions?