I stumbled across the following and can't seem to work out why this works. Please can you explain why I don't need to use a pointer before range
?
NSString *d = @"The quick brown fox";
NSRange range = [d rangeOfString:@"brown"];
I stumbled across the following and can't seem to work out why this works. Please can you explain why I don't need to use a pointer before range
?
NSString *d = @"The quick brown fox";
NSRange range = [d rangeOfString:@"brown"];
NSString
is an object type. All object types are pointers and can't be created on the stack. NSRange
is a C-struct. Structs can be created on the stack, and thus aren't necessarily all pointers.
There isn't a good guide to know which ones are objects, and which are structs. You'll just have to check for each type as you move forward.
© 2022 - 2024 — McMap. All rights reserved.