*p=<anything other than a variable>
This line is executed in the following way.
<anything other than a variable or a pointer> is a literal and is stored in the read-only part of the memory and the pointer is pointing to that memory. We can write *p as p[0]. So, when p[0]='a' is being executed, it wants to modify a data inside the read-only part and this is illegal. Hence it will give runtime error.