Question.3
A command dispatcher uses a function pointer array of size 4 (indices 0–3):
int (*ops[4])(int,int) = {add, sub, mul, div_fn}; result = ops[cmd](a, b);
What happens if cmd = 5?
cmd = 5
Select Answer
Returns 0 — uninitialized entries default to a no-op function
Undefined behavior — ops[5] reads past the array and calls a random memory address as a function
ops[5]
Compilation error — the compiler catches the out-of-bounds index
Calls the last valid function (div_fn) as a fallback
div_fn