Having such a simple C++
function pointer example:
#include <stdio.h>
void my_int_func(int x) {
printf("%d\n", x);
}
int main() {
void (*foo)(int);
foo = &my_int_func;
foo(78);
return 0;
}
What is the type of the address pointed by the foo
? Is it just a relative address of the my_int_func
function from the program starting point (the main
function) and hence is it always the same (just because it is relative)?
P.S.
Sorry if the questions are obvious/lame but I'm just a beginner in the topic...
Thx for help!