qfedu-c-level/day12/d8_test1.c

13 lines
274 B
C

#include <stdio.h>
int main()
{
char m[30] = "lucy, 666";
char *const p = m; // 必须初始化, 不等于 const char *p = m;
p[0] = 'd';
*(p + 1) = 'o';
printf("%s\n", p);
// p = "jack"; // 编译时报错: 因为 p 是只读变量
return 0;
}