摘要:
1、指向const的指针 const 修饰“最靠近”它的那个。 const int* u;//u是一个指针,它指向一个const int const int* u;//u is a primer, point to a const int const int a = 10; u = &a; cout<<a<<endl; cout<<*u<<endl; //*u = 3;//error 它指向的值不能改变2、const 指针 int d = 1; int* const w = &d;//w是一个指针,这个指针是指向int的const 阅读全文
posted @ 2013-03-18 13:19
wiessharling
阅读(170)
评论(0)
推荐(0)
摘要:
1、声明:一个声明将一个名称引入一个作用域;在c++中,在一个作用域中重复一个声明是合法的以下都是声明:int foo(int,int); //函数前置声明 typedef int Int; //typedef 声明 class bar; //类前置声明 extern int g_var; //外部引用声明 class bar; //类前置声明 typedef int Int; //typedef 声明 extern int g_var; //外部引用声明 //friend test; //友员声明 using std::cout; //名字空间引用声明 /... 阅读全文
posted @ 2013-03-18 10:58
wiessharling
阅读(270)
评论(0)
推荐(0)