In one of the C++ programs, I saw a function prototype : int Classifier::command(int argc, const char*const* argv)
What does const char*const* argv
mean? Is it the same as const char* argv[]
?
Does const char** argv
also mean the same?
From the C++ Super-FAQ:
Read the pointer declarations right-to-left.
const X* p
means "p
points to anX
that isconst
": theX
object can't be changed viap
.X* const p
means "p
is aconst
pointer to anX
that isnon-const
": you can't change the pointerp
itself, but you can change theX
object viap
.const X* const p
means "p is aconst
pointer to anX
that isconst
": you can't change the pointerp
itself, nor can you change theX
object viap
.And, oh yea, did I mention to read your pointer declarations right-to-left?
const char * const *
is the same as char const * const *
: a (non-const) pointer to a const pointer to a const char.
const char *
is the same as char const *
: a (non-const) pointer to a const char.
const char * *
is the same as char const * *
: a (non-const) pointer to a (non-const) pointer to a const char.