I'm trying to output and 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]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With