+ 1

const_cast: don’t understand specific internals of challenge

The following code is an already existing SoloLearn C++ challenge (plus some extra output): https://code.sololearn.com/cJz3vfRpCZ93/?ref=app I don’t understand the internal working of the value of the dereferenced *p after the const_cast (outputs 0). Pointer p still points to i and dereferenced pointer has different value than i? Is the compiler doing this at compile time? Or is my brain taking the wrong route somewhere?

2nd Apr 2018, 4:27 PM
Marius Heise
Marius Heise - avatar
2 Respuestas
0
99
2nd Apr 2018, 4:32 PM
✌️ RK ✌️
✌️ RK ✌️ - avatar
0
Anybody? 😜
3rd Apr 2018, 6:58 AM
Marius Heise
Marius Heise - avatar