i have been trying to get the address of a function and use that hex number for other calculations. I have read that you cannot get the address of a function like you get the address of a variable in c/c++. I have tried casting to `void*` and function pointers but none of them seems to be working. As I get different numbers everytime I try to assign the address to a variable or pass it to a function or use it in any way.

    int main(){
    std::cout<<&funct<<std::endl;
    }
    
    //Output is: 0x010111b3
But when I look at the disassembly the function starts at 0x01012580. And the difference is not constant. It might be a compiler issue but i don't know how to fix it. Can anyone help me please?

Thanks

**UPDATE**

**SOLVED**

The issue was with the compiler options. When built using g++ i would get the normal address of the function. But when built using visual c++ compiler i would get a different address rather than the original address of the function. However switching 'Enable Incremental Linking' option off in the 'Project Properties->Linker->General' option solved my problem.

Thanks to everyone.