怎么用函数返回变量的地址

怎么用函数返回变量的地址 我们先分别讨论一下,返回局部变量地址 和 返回全局变量地址 返回局部变量地址 #include <stdio.h> //这是错误的示范,不能返回局部变量的地址 int *fun() { int a; return &a; } int main(int argc, char const *argv[]) { int *p = NULL; p = fun();
相关文章
相关标签/搜索