i'm trying to remove const-ness from a variable (char*), but for some reason when i try to change the value, the original value of the const variable still remains the same.
const char* str1 = "david";
char* str2 = const_cast<char *> (str1);
str2 = "tna";
now the value of str2 changes but the original value of str1 remains the same, i've looked it up on Google but couldn't find a clear answer.
when using const_cast and changing the value, should the original of the const variable change as well ?