I'm trying to output and C++开发者_C百科 Array (int inverse[3]
) using NSLog
, but If I try this way:
NSLog([NSString stringWithFormat:@"%d", inverse]);
It just dont work, But if I try like this:
NSLog([NSString stringWithFormat:@"%d", inverse[0]]);
I get the right output. My objective is to get the whole array outputed.
Any ideas? Thanks
Use a for loop to print all the values.
for (int i=0; i<3; i++) {
NSLog(@"%i", inverse[i]);
}
or:
NSLog(@"%i, %i, %i", inverse[0], inverse[1], inverse[2]);
There is no need need to convert for string format conversion. You can print like these -
for ( int i=0; i<3; ++i )
NSLog(@"%i", inverse[i]);
精彩评论