String formatting tokens

String formatting tokens reference sheet:

Token Data Type
s char (cstring)
d int
f float
.2f float rounded to 2 decimal places
p pointer
zu size_t
@ An object’s description

If you want to print a bool, you can do it like this:

NSLog(@"%@", BOOL_VAL ? @"YES" : @"NO");

 

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.