C中指针与成员变量生命周期的示例
引言
本文针对于碰到的指针做一些记录。详见下面的示例。
示例一
返回char类型指针,使用局部静态数组。
#include <stdlib.h>
char * GetTestMemory(void)
{
static char p[] = "hello world";
printf("src=%x\n",p);//数组首地址
printf("Move=%x\n", p+1);//数组的首地址+1
printf("ArrMove=%x\n", &p + 1);//整个数组的地
原创
2022-05-31 18:32:00 ·
381 阅读 ·
1 评论