#includeusing namespace std; struct Teacher { char name[10]; int age; }; //指针所指向的内存空间,不能修改 int operatorTeacher01(const Teacher *pT) { // pT—>age=10; return 0; } //指针变量本身,不能修改 int operatorTeacher02( Teacher * const pT) { //pT—>age=10; //pT=NULL; return 0; } int operatorTeacher03( const Teacher * const pT) { //pT—>age=10; //pT=NULL; printf("%dn",pT->age); return 0; } int main(){ // const int a; // int const b;//与上相同 // const int *c;//const修饰的是指针所指向的内存空间,不能被修改 // int* const d;// // const int *const e; cout<<"hello..."< 1.const是定义常量,意味着只读
#includeusing namespace std; int main() { const int a=10; int*p=NULL; p=(int*)&a; *p=20; printf("a:%dn",a); system("pause"); }



