14.关于创建字符串&字符数组&指针的思考

#include <stdio.h>
#include <stdlib.h>
int  main()
{
   const char *pt = "abcdef";
   /*
     1.abcdef字符串字面量对象
     2.字符数组对象(单个元素也是对象)
     3.标识符为pt的对象,存储字符串的地址
     const 修饰的是字符串字面量对象和字符数组对象,也就是他们的内容不能被修改
     但是pt对象的内容是可以修改的
   */
   //修改pt对象的内容
   printf("%p\n", pt );
   char ch = 'a';
   pt = &ch;
   printf("%p\n", pt);
 
   return 0;
}

 

posted @ 2021-07-09 20:13  学而不思则罔!  阅读(46)  评论(0)    收藏  举报