我正在使用一个小命令行实用程序,并且遇到了错误。错误读取
“预期标识符或'('之前'='' 令牌“在循环中。
以下是代码:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// insert code here...
int i;
NSMutableArray *items = [[NSMutableArray alloc]init];
[items addObject:@"One"];
[items addObject:@"Two"];
[items addObject:@"Three"];
[items insertObject:@"Zero" atIndex:0];
for (int = 0;i < [items count];i++) {
NSLog(@"%@", [items objectAtIndex:i]);
}
[pool drain];
}
一直试图找到错误,但不能。你的帮助表示赞赏TIA
答案 0 :(得分:1)
变化:
for (int = 0;i < [items count];i++) {
为:
for (int i = 0;i < [items count];i++) {