I am reading application code developed in the IBM RSARTE C++ version. Here is a piece of C++ code:
const char * const * av = RTMain::argStrings();
How to understand the left-hand side syntax when there are two const
and two *
?
const char * const * av = RTMain::argStrings();
is the same as
char const * const * av = RTMain::argStrings();
const
applies to what's left of const
.
So, av
is a non-const
pointer to a const*
to const char
.
av
, is non-const
and can be changed.av
is pointing at is const
and can not be changed.char
that pointer is pointing at is const
and can not be changed.