Reputation: 12663
I'm doing a class that will handle digit by digit arithmetic (i.e. arithmetic for numbers of any size).
I have this for loop which crashes on runtime, and complains that "column" is null. Can anyone shed some light on this?
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 column is an int, declared as an instance variable. Also, that NSLog prints out "column (null)"
Upvotes: 0
Views: 83