to see If I can change memory location pointed by an array using const_cast
Arrays don't point to anything. They are a sequence of objects.
What this error message means ?
The value category of a cast expression to non-reference type is prvalue. You can only use a lvalue as the lefthand operand of assignment operator. Therefore you cannot use a cast expression as the lefthand operand in an assignment.
does this means I can take constness from array ...
The array isn't const in the first place, so using const_cast to remove constness doesn't make sense.
... but not change it's value ?
You can change the value of the objects in a non-const array, but arrays cannot be assigned to another, even if they are non-const. You cannot assign a pointer to an array variable either.
I can't just do arr=&a as arr being array is const pointer
No, an array is not a const pointer.
As I pointed out earlier, you can't do that because you cannot assign a pointer to an array variable.
Currently you're trying to change the type of int[10] to int*. They are unrelated types. const_cast can only be used to change constness or volatility. It cannot be used to change the type.
If you want to point to a memory location, then what you need is a pointer. To create a pointer variable, you cannot simply cast an array. Here is an example of how to define a pointer and initialize it to point to the first element of an array:
int arr[10];
int* pointer = arr;
And this is how you can change the memory location pointed by the pointer:
int arr2[10];
pointer = arr2;