开发者

Can't find error in command line application

Am working on a small command line utility, and have run into error. The error reads

"Expected identifier or '(' before '=' token" in the loop.

Here is the code:

    #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 <开发者_JAVA技巧 [items count];i++) {
         NSLog(@"%@", [items objectAtIndex:i]);
     }
    [pool drain];

}

Have been trying to find the error, but couldn't. Your help appreciated. TIA


Change:

 for (int = 0;i < [items count];i++) {

to:

 for (int i = 0;i < [items count];i++) {
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜