I'm running through some example programs to refamiliarize myself with C++ and I have run into the following question. First, here is the example code:
void print_string(const char * the_string)
{
cout << the_string << endl;
}
int main () {
print_string("What's up?");
}
In the above code, the parameter to print_string could have instead been const char * const the_string. Which would be more correct for this?
I understand that the difference is that one is a pointer to a constant character, while the other one is a constant pointer to a constant character. But why do both of these work? When would it be relevant?