#include <stdio.h>
int main()
{
int values[5] = {1,2,3,4,5};
const int * pValue1 = values;
pValue1 += 3; //编译成功
//pValue[0] = 7; //编译出错
int * const pValue2 = values;
//pValue2 += 3; //编译出错
pValue2[0] = 7; //编译成功
const int * const pValue3 = values;
return 0;
}
常量指针和指针常量
最新推荐文章于 2024-04-20 07:00:00 发布