According to the c++ grammar, const int* const p means that what p points to and it' value can't be rewritten.But today I found that if I code like this:
void f(const int* const p) { char* ch = (char*) p; int* q = (int*) ch; (*q) = 3; //I can modify the integer that p points to } In this condition,the keyword "const" will lose it's effect.Is there any significance to use "const"?
ffunction, doesnt it?const_castyet