Declare entry
as const char *
(or, equivalently, char const *
). This is a non-constant pointer to constant characters: you can change the pointer itself to make it point to different characters, but you can't modify the actual characters through the pointer.
A constant pointer — one that you can't change to point to something else — would be char * const
, or char const * const
to prevent both the pointer and the pointed-to characters from being modified.
The easiest way to read types involving const
is from right to left: char const *
is a pointer to constant char
, and char * const
is a constant pointer to char
. The const
keyword always applies to the type on its left. (As a special case, if it's written at the beginning so that there's nothing to its left, it applies to the type on its right instead. That's why const char
is equivalent to char const
.)