#import <Foundation/Foundation.h>
int main(int argc,const char * argv[]) {
@autoreleasepool {
constchar *words[4]={"zhangsan","lisi","wangwu","zhaoliu"};
int wordcount=4;
for (int i=0; i<=wordcount; i++) {
NSLog(@"%s有 %lu字符长度",words[i],strlen(words[i]));
}
}
return0;
}
2017-06-26 22:29:59.957292+0800 test1[40038:15502666] zhangsan有 8字符长度
2017-06-26 22:29:59.958072+0800 test1[40038:15502666] lisi有 4字符长度
2017-06-26 22:29:59.958099+0800 test1[40038:15502666] wangwu有 6字符长度
2017-06-26 22:29:59.958117+0800 test1[40038:15502666] zhaoliu有 7字符长度
2017-06-26 22:29:59.958133+0800 test1[40038:15502666] 有 0字符长度
Program ended with exit code: 0