The following code receives seg fault on line 2:
char *str = 'string'; str[0] = 'z'; // could be also written as *str = 'z' printf('%s\n', str);
While this works perfectly well:
char str[] = 'string'; str[0] = 'z'; printf('%s\n', str);
Tested with MSVC and GCC.
See the C FAQ, Question 1.32