指针和const
来源:互联网 发布:知乎宇宙高维 编辑:程序博客网 时间:2024/06/15 09:43
const int * pt = &age;*pt += 1;//invalid because pt points to a const int
*pt 的值为const int ,不能被修改。可以通过age来修改age的值,但pt不可以。
int sage = 80;const int * pt = &sage;
可以将一个新的地址赋给pt。
不能将const的地址赋给常规指针。
int * const finger = &sloth;
finger只能指向sloth。finger 和 *ps 都是const ,而*finger和 ps不是。
阅读全文
0 0
- const引用和const指针
- const指针和const引用
- const数据和const指针
- 指向const的指针和const指针
- const对象的指针和const指针
- const指针和指向const的指针
- 指向const的指针和const指针
- 【C和指针】const指针
- 指针和const
- const和指针
- 指针和const
- const和指针
- const 和 指针
- 关于const和指针
- const和指针
- const和指针
- 指针和const
- const和指针
- rm: remove regular file `t1.sh'?
- js计数器问题探究
- 实现u-boot对yaffs/yaffs2文件系统下载的支持
- Google MapReduce 中文版
- Maven搭建SSM项目时的pom.xml文件配置
- 指针和const
- Visual Studio 2015 安装问题详解
- C# 中的委托和事件
- Android ListView常用属性解析
- bzoj 1647: [Usaco2007 Open]Fliptile 翻格子游戏(枚举)
- C#事件(event)解析
- [BZOJ1095][ZJOI2007]Hide捉迷藏-动态树分治
- UVALive-7385-FlippingCards(并查集判环)
- 实战Metasploit之安卓渗透舍友