C++ examples for Data Type:Cast
If you want to convert from a const to a non const or from a volatile to a non volatile, you use const_cast.
int main() {/*from w w w. j a v a 2 s .co m*/ const int i = 0; int* j = (int*)&i; // Deprecated form j = const_cast<int*>(&i); // Preferred volatile int k = 0; int* u = const_cast<int*>(&k); }