[C++] c pointer
- the nature of pointer
- const keyword
- const int* p
- int const *p
- int* const p
- int const a
- const int a
int a = 3;
int b = 5 ;
int* const p = &a;
*p =10;
//p = &b; error: address can not be modified , but the content can be modified
const int* p2 = &a;
p2 = &b;
//*p2 = 7; error : address can be modified , but the content can not be modified
int const *p3 = &a;
p3 = &b;
//*p3 = 3; error : address can be modified , but the content can not be modified
//*p3 = 7; error