6.6.2 const指针 当用关键字 const来修饰一个指针时,视其位置的不同则意 义亦不相同。例: const char pc=" Points to constant char";∥指向常量 char const cp="Constant pointer ∥常指针 const char *const cpc ="Constant pointer points to constant char ∥指向常量的常指针 pc =a, ∥错误! cp= gp, ∥错误!
6.6.2 const 指针 当用关键字 const 来修饰一个指针时,视其位置的不同则意 义亦不相同。例: const char *pc = "Points to constant char"; // 指向常量 char *const cp = "Constant pointer"; // 常指针 const char *const cpc = "Constant pointer points to constant char"; // 指向常量的常指针 *pc = 'a'; // 错误! cp = qp; // 错误!
第7章结构、联合和枚举 7.1类型定义 typedef type identifier; 其中: typedef是C+语言的一个关键字;pe是任何一个 合法的数据类型(包括用户定义的数据类型); identifier是 个标识符,它就是用户为所定义的数据类型取的名字 例 typedef int Integer; typedef unsigned long UL
第7章 结构、联合和枚举 7.1 类型定义 typedef type identifier; 其中:typedef 是 C++ 语言的一个关键字;type 是任何一个 合法的数据类型(包括用户定义的数据类型);identifier 是 一个标识符,它就是用户为所定义的数据类型取的名字。 例: typedef int Integer; typedef unsigned long UL;