In your example, *second
(the char
object) is const
(just as *ptr
, the char
object, in my example is const
). Just try doing *second = 'x';
and watch the compiler rightfully complain. second
is not const
, so you can legally do second = "another string";
.
In my example, both *ptr
(the char
object) and ptr
(the pointer) are const
, and you can't modify either one.