Skip to content

Instantly share code, notes, and snippets.

@SlaunchaMan
Created May 14, 2012 19:51
Show Gist options
  • Save SlaunchaMan/2696148 to your computer and use it in GitHub Desktop.
Save SlaunchaMan/2696148 to your computer and use it in GitHub Desktop.
Fun with C strings
NSString *c = @"C";
NSString *a = @"A";
const char *cValue = [c cStringUsingEncoding:NSASCIIStringEncoding];
const char *aValue = [a cStringUsingEncoding:NSASCIIStringEncoding];
NSLog(@"The value of 'C' - 'A' is %d", (int)(cValue[0] - aValue[0]));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment