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++) {
精彩评论