Earlier quoted context omitted.
It will print 10. There's absolutely no issue there at all. You've changed the value of the pointer which is NOT const. const int \*b Means a pointer to a thing that is const. The pointer itself (which is on the stack in this case) is NOT const. const int *b = 9; *b = 10; ^^^ This will NOT compile. const int b = 9; int main() { int *a = (int *)b; *a = 10; } ^^^ This will compile (possibly with warnings). If you run i…
No I don't want to throw it out, I kinda like C. And you can also do seemingly weird things with it. I was trying to bring some light to how const and immutable could be conflated. A lot of people see const and think, no aspect of this is changeable.
Using a pointer to iterate through a string/array/other data structure, that is stored in const is a completely standard thing to do.