> 
> **Possible Duplicate:**  
> 
> [Why does simple C code receive segmentation fault?](https://stackoverflow.com/questions/164194/why-does-simple-c-code-receive-segmentation-fault) 
> 
> 
> 

Why code snippet 2 doesn't behave like snippet 1?

```
//Code snippet 1
char pstr[] = "helloworld";
char *p = pstr; 
p[2] = 'd';

//Code snippet 2
char *p = "helloworld";
p[2] = 'd'; //error: access violation

```

P.S Forgive my ignorance.