对于循环计数器返回null?

时间:2012-08-30 03:55:06

标签: objective-c for-loop

我正在做一个将逐个数字算术处理的类(即任何大小的数字算术)。

我有这个for循环,它在运行时崩溃,并抱怨“column”为null。任何人都可以对此有所了解吗?

for(column=0; column < bigger.length; column++) {
    NSLog(@"column %@", column);
    workingDigit = [y intAt:column] + [self intAt:column] + carry;
    carry = workingDigit / 10;      //make the carry not include the last digit of the sum
    workingDigit = workingDigit % 10;      //make the digit not include the carry

    [result insertString:[NSString stringWithFormat:@"%d", workingDigit] atIndex:0];
}

btw列是一个int,声明为实例变量。此外,NSLog打印出“column(null)”

1 个答案:

答案 0 :(得分:2)

你应该用这个:

NSLog(@"column %d", column);
相关问题