Skip to content

Instantly share code, notes, and snippets.

@GaretJax
Created April 26, 2010 12:38
Show Gist options
  • Save GaretJax/379277 to your computer and use it in GitHub Desktop.
Save GaretJax/379277 to your computer and use it in GitHub Desktop.
int main (int argc, const char * argv[]) {
char m = 'a';
char * m2 = &m; // Assign address of m to m2
char * m3 = "a"; // Create a new string and assign its starting address to m3
*m2 = 'x'; // OK
*m3 = 'x'; // EXEC_BAD_ACCESS
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment