CS153/hw5/hw5programs/compile_array_fptr.oat

8 lines
198 B
Text
Raw Normal View History

int add(int x, int y) { return x + y; }
int sub(int x, int y) { return x - y; }
int program(int argc, string[] argv) {
var ops = new ((int, int) -> int) [] { add, sub };
return ops[0](1, 1);
}