class str
{
char *p;
public:
string(const char *s);
}
I am confused about the difference between these two declarations.
class str
{
char *p;
public:
string(const char *s);
}
I am confused about the difference between these two declarations.
const char *
is a pointer to a const char, you cant change the value being pointed to, but you can change the pointer
char * const
is a constant pointer to a char, [behaving like a reference type] you can change the value pointed to but you cant change the pointer.
const char * const
is a constant pointer to a constant char, [both are constants]