我在下面的代码片段中找到了
const int i = 2; const int* ptr1= &i; int* ptr2 = (int*)ptr1; *ptr2 =3;
i价值变为3.我想知道的是为什么允许这样做.有什么情况可以变得有用?
i
c c++
c ×1
c++ ×1