摘要:
(1)int age=30; const int * pt=&age; 表示 *pt 是一个const ,即不能通过使用pt来修改这个值,但可以直接通过age变量来修改age的值, 也可以将新地址赋给pt.(2)int age=30; int * const pt=&age; 表示pt是一个const ,即pt只能指向age, 但允许使用pt来修改age的值。(3)int age=30; const int * const pt=&age; 表示pt和*pt都是const.区别在于const与*的相对位置,而int与const的位置可互换。即 int const*pt 阅读全文
posted @ 2011-07-01 22:15
shiney
阅读(1186)
评论(0)
推荐(1)
浙公网安备 33010602011771号