In my book of c++ I just found a code where the book says there is an undefined behaviour.
# include <iostream>
using namespace std;
int main( )
{
const char * a = "aaa";
char * b = const_cast<char *>(a);
cout << a << '\n' << b << '\n';
b[0] = 'b'; // here undef. behaviour
cout << a << '\n' << b << '\n';
}
I don't understand why . Does anyone know it ?