Android Fatal signal 11 (SIGSEGV) at 0x636f7d89 (code=1). How can it be tracked down?

I’ve been reading the other posts on tracking down the reasons for getting a SIGSEGV in an Android app. I plan to scour my app for possible NullPointers related to Canvas use, but my SIGSEGV barfs up a different memory address each time. Plus I’ve seen code=1 and code=2. If the memory address was 0x00000000, … Read more

Why do I get a segmentation fault when writing to a “char *s” initialized with a string literal, but not “char s[]”?

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. 19 Answers 19