常量指针/常指针://指向常量值的指针;
const int x=5;
const int* test=&x;
//c此时*test指向的是const值 不可以通过*test的操作来修改x的值
const char* s1="hello";
//注意:使用char* s2="hello";是不可行的;因为,hello是常量,const类型,无法赋值给char*类型
此时,cpp将hello的首地址赋值给s2;
指针常量:指向变量值的一个不可变指针
int x=10,y=10;
int* const p=&x;
*p=10;//okay
p=&y;//error
//这个意思是说,p只能指向x,不能修改它所指向的东西
注意:const int* p!=int* const p;
cpp11
using take place of typedef
eg
using Uint=unsigned int;
typedef unsigned int Uint;
//用自行定义的类型名代替已经定义的类型名字
usintg Functype=void (*) (int,int);//函数的别名
void example (int,int){}
Functype f=example;
//注意:
编码规范:类型名首字母大写
一元作用域解析运算符 ::
#include<iostream>
int v=10;
int main()
{
int v=5;
std::cout<<v;//5
std::cout<<::v;//10 全局变量使用
}