C中局部变量指针问题

先提问题,在类似如下的函数中: char *GetMemory(void) { char p[] = "hello world"; printf("%p\n",p); return p; } 问题1: printf("%p\n",p); // 对p的有什么影响?请对比GetMemory0和GetMe...

返回局部变量指针

一般我们都知道不能返回局部变量的指针,但很多人知道其然,不知道所以然,那么接下来我们分析一下,先看两段代码 /*test1.c*/ #include <stdio.h>char* get_str(){    char str[] = {"hello"};&n...

本页面内关键词为智能算法引擎基于机器学习所生成,如有任何问题,可在页面下方点击"联系我们"与我们沟通。