`
tibaloga
  • 浏览: 871864 次
文章分类
社区版块
存档分类
最新评论

品尝常量指针和指针常量的味道

 
阅读更多

#include<iostream.h>

void main()

{ const int *a;

int hh=12;

int bb=14;

int *const fb;//error C2734: 'fb' : const object must be initialized if not extern int *const

b=&hh;//必须付初值

a=&hh;//true a=&bb;//true

*a=111;//error C2166:

l-value specifies const object[常量指针:指向的值是不能变的,地址可以变] hh=15; *b=hh;//指针常量:指向的值是可以变的,但是指针不能变 cout<<*a<

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics