I want to use class variable. the following two approaches work well, but I don’t know what’s the different between them.
static NSString *str1 = @"str1";
NSString *const str2 = @"str2";
@implementation StrViewController
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
you can change the location to where
str1is pointing to but cannot do the same forstr2as it is a const pointerthis will work :
while this won’t: