NSString stringWithFormat: with C array?

Posted by Chris Long on Stack Overflow See other posts from Stack Overflow or by Chris Long
Published on 2010-04-16T17:18:10Z Indexed on 2010/04/16 17:23 UTC
Read the original article Hit count: 321

Filed under:
|
|
|

Hi,

I'm writing a program that calculates the Jacobi algorithm. It's written in Objective-C since it runs on a Mac, but the majority is written in standard C. I'm using a two-dimensional C array and an NSArray containing 5 NSTextField labels.

The following code yields an EXC_BAD_ACCESS error:

for ( int i = 0; i < 5; i++ ) {
     NSString *resultString = [NSString stringWithFormat:@"%g", matrix[i][i] ];
     [[resultLabels objectAtIndex:i] setStringValue:resultString]; // error line
}

Any help?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about c