摘要: const(控制变量是否可以变化) const int x=3;(则此时x为常量,不可进行再赋值) const与指针类型 const int *p=NULL; int const *p=NULL;(两种写法完全等价) int *const p=NULL; const int *const p=NULL; int const *const p=NULL;(这两种写法也是完全等价的) int x=... 阅读全文
posted @ 2019-07-23 16:37 xjyxp01 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 引用就是指变量的一个别名(不能只有别名) 引用必须初始化。 int a=3; int &b=a;(为a起个别名b,也是将别名b初始化为a) b=10;(对别名做任何操作都是对其本身做操作) 结构体类型的相关引用 struct Coor{ int x,y; } Coor c1; Coor &c=c1; c.x=10; c.y=20; 指针类型的引用:类型*&指针引用名=指针; int a=10... 阅读全文
posted @ 2019-07-23 16:27 xjyxp01 阅读(100) 评论(0) 推荐(0) 编辑