Possible Duplicate:
Modifying value of char pointer in c produces segfault
This is a piece of code ...
void main()
{
char *p="Hello";
*p= 'h'; // Segmentation fault .
}
I understand the fact that there is a segmentation fault and it gives me a run time error also .But I wonder , why is it a RUN TIME ERROR ?? Why cant the compiler tell me before executing the program ? Why does not it show a COMPILE TIME ERROR ?
PS : I use Visual C++ 2005 Express ..