C 或 C++ 中函数的地址
在C或C++中,变量存储在内存中,因此我们可以获得它们的内存地址。同样,函数也存储在内存中,因此它们也有一些地址。要获取地址,我们可以只使用函数名称,而不使用括号。
请检查以下程序以获得清晰的想法。
示例
#include void my_function() { printf("Hello World"); } int main() { printf("The address of the my_function is: %pn", my_function); printf("The address of the main is: %pn", main); }登录后复制