0

我正在做一门逐位算术的课程(即任何大小的数字的算术)。

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

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];
}

顺便说一句,列是一个 int,声明为实例变量。此外,该 NSLog 打印出“列(空)”

4

1 回答 1

2

你应该使用这个:

NSLog(@"column %d", column);
于 2012-08-30T03:59:04.917 回答