Hi all,
May I ask what I thought would have been a simple issue. ( other questions relating to the same, ref a small difference, but usually sizeof is larger than strlen, ....accounted for by NULL)
Given this code:
output:
"sizeof" "Some data value." = 8
"strlen" "Some data value." = 16
strlen of 16 I understand. But why is storage of the same variable only 8 bytes?
Sorry if this is really obvious.
thank you.
May I ask what I thought would have been a simple issue. ( other questions relating to the same, ref a small difference, but usually sizeof is larger than strlen, ....accounted for by NULL)
Given this code:
Code:
NSString *testString = @"Some data value.";
const char *cStringForHashValueClass = [testString UTF8String];
NSLog(@"\"sizeof\" \"%s\" = %i", cStringForHashValueClass, sizeof(cStringForHashValueClass) );
NSLog(@"\"strlen\" \"%s|' = %i", cStringForHashValueClass, strlen(cStringForHashValueClass));
output:
"sizeof" "Some data value." = 8
"strlen" "Some data value." = 16
strlen of 16 I understand. But why is storage of the same variable only 8 bytes?
Sorry if this is really obvious.
thank you.