有点忘了:
#include "stdafx.h"
#include <stdlib.h>
int _tmain(int argc, _TCHAR* argv[])
{
printf("hello,world");
///指向const对象的指针,const:翻译成只读的更好
const double *cptr;
//*cptr=40; ///error
const double pi=3.14;
cptr=π ///ok
const void *cvptr=π
//void *vptr=π ///error
double dval=3.14; ///dval is a double; its value can be changed
cptr=&dval; ///ok: but can't changed dval through cptr
//*cptr=6.28; ///error
//不能保证指向const的指针所指对象的值一定不能修改
///const指针:定义时必须初始化
int errNumber=0;
//int *const curError; ///error:“curError”: 如果不是外部的,则必须初始化常量对象
int *const curErr=&errNumber;
//curErr=curErr; ///error
///curErr是指向int型对象的const指针
system("pause");
return 0;
}
困。