- arr itself is a "char[5]" not a "const char (*)[5]". And it is implicitly cast to a "char *" rvalue when you write cin >> arr. It's not a const because it is not even a lvalue.
And "const char *" or "char const *" mean the lvalue pointed to cannot be changed, while "char * const" means the pointer lvalue itself cannot be change. But this has nothing to do with you question, though.
- First, there was no whitespace. And it is cin appended the null character.
An array is just an array:
char a[5]; //a's type is char[5];
But an array can hardly be an operand. Only operators I can remember that accept array type are sizeof and &(address-of) (On the other hand, this means sometimes a have to be an array. Or else if you write sizeof(a), it will give you the size of a pointer.). For other operations a is converted to a char * rvalue. And yes, even when you write a[0], a[1], etc. a[0] is equivalent to *(a + 0), which operates on pointers but not arrays.
When you cannot assign to something, it doesn't always mean that thing is "const":
- You cannot assign to a const variable of course.
- You can only assign to a variable(or aka lvalue), so you cannot assign something to a rvalue(or aka value). So you cannot write 1 = 2, because 1 is an rvalue not a variable, not because 1 is "const".
- You must assign something to a variable that matches its type. So if you have a const char *p and a char *q, you cannot write q = p. Their types don't match. And again, it doesn't mean q is const, for it's obviously not. But you can write p = q, because char * can be implicitly cast to const char *. But const char * have to be cast to char * explicitly.