我定义了一个指向函数的简单函数指针,当我尝试输出时,它的值为 1。幕后发生了什么?(我在mac上,用c++11 g++编译器编译)
#include <iostream>
int foo()
{
return 5;
}
int main(int argc, char const *argv[])
{
int (*fcptr)() = foo;
std::cout<< fcptr;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
输出为1。