摘要: 1.奇怪的现像: int get(int ); int get(const int); //上面这样是可以的,不报错 int get(int ); double get(const int); //error: ambiguating new declaration of 'double get(i 阅读全文
posted @ 2020-10-29 21:07 lypbendlf 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 1.指向常量的指针和指针常量 int a=0; const int *const p=&a; // *p=2;//error: assignment of read-only location '*(const int*)p' int *const p1=&a; *p1 =3;//正确 在p的生命中 阅读全文
posted @ 2020-10-29 20:11 lypbendlf 阅读(183) 评论(0) 推荐(0) 编辑
摘要: https://www.zhihu.com/question/26872913 这个解释非常好,重复包含就是重复定义,那么就会报错了。 阅读全文
posted @ 2020-10-29 17:52 lypbendlf 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 转自:https://www.cnblogs.com/mrlsx/p/5510496.html 1.NULL为0值,nullptr是指针对象 NULL是一个宏定义,c中NULL为(void*)0,而c++中NULL为整数0: //C语言中NULL定义 #define NULL (void*)0 // 阅读全文
posted @ 2020-10-29 17:03 lypbendlf 阅读(306) 评论(0) 推荐(0) 编辑