Below is an exceedingly simple example. It compiles fine using gcc on Mac OS X (Snow Leopard). At runtime it outputs Bus error: 10. What\'s happening here?
char *str = "string"; In such a case it is treated as a read only literal. It is similar to writing const char *str = "string". Which is to say that the value pointed to by the pointer str is a constant. Trying to edit will result in BUS ERROR.