What is the correct Address of a C++ function or function pointer

Viewed 138
typedef int (*fooPtr)(int);

int foo(int a) {
    return a + 1;
}


int main(){

    void* funcPtr1 = reinterpret_cast<void*>(foo);
    void* funcPtr2 = foo;
    void* funcPtr3 = &foo;
    fooPtr funcPtr4 = foo;


}

in Visual Studio's Watch window I get the same address for all funcPtr's (1-4) but when I type in the function name itself foo; I get a different address. What is the actual address of the function foo. Meaning, the actual code that the assembler will eventually run. and what is the alternate address then?

watch window

0 Answers
Related