【C深入】Const常量与指针
程序员文章站
2022-03-25 23:05:10
...
#include <stdio.h>
int main()
{
int i = 0;
const int* p = &i;
*p = 5;
return 0;
}
右指:不变
#include <stdio.h>
int main()
{
int i = 0;
int* const p = &i;
// *p = 5;
p = NULL;
return 0;
}