结果代码只打印出我的 Xcode 中数组的第一个元素,即使我传递了三个单词。有什么理由吗?
char str[100] = {0};
NSLog(@"Please enter three words: ");
scanf("%s", str);
NSString *words = [NSString stringWithUTF8String: str];
NSMutableArray *mutableWords = [[words componentsSeparatedByString: @" "] mutableCopy];
NSLog(@"%@", mutableWords);