I am writing a program for my class that in a VERY simplified way mimics the way an operating system interrupts handling.
In C, I have an array INTERRUPT_TABLE[]that I declared with:
typedef void (*FN_TYPE)();
extern FN_TYPE INTERRUPT_TABLE[];
I want to set it so that each position in the array points to the beginning of another function that is contained elsewhere in my program - for example, it INTERRUPT_TABLE[0]should point to the beginning of the function handle_trap().
I thought I could just say: INTERRUPT_TABLE[0] = handle_trap;but that doesn't work. I get a compiler error saying: "kernel.c: 134: error: indexed value is neither an array nor a pointer." Does anyone know what I'm doing wrong?
Thanks for the help.
edit: find out! I had INTERRUPT_TABLE over the functions that I was trying to call, so they were automatically declared as ints
amb691 source
share