Creating Function Pointers in C
Given the following functions, declare function pointers that point to them and include a sample call to each
Convert Java instance-method call into equivalent C code that uses function pointers
void pong(int i) {
printf(“pong: %d\n”, i); }
int pong_ret(int i) { printf(“pong: %d\n”, i); i++;
return i;
}
Polymorphism Java
C
From C to Assembly with Function Pointers
Other Uses of function pointers
Difference between indirect jump and double-indirect jump
Indirect jump –
Double indirect jump –
What prints to the screen Assume the following
The address of a[0] is 0x2000 The address of value is 0x3000 The address of pofdt is 0x4000
Implement the calls to either proc or foo in assembly for the code snippets below
Write a function that creates a generic comparator function. The function should return 0 is the values are the same, -1 if the first is smaller, and 1 if the second is smaller. Feel free to test the function with the cmpStrings and cmpIntegers procedures in Module 1F