What format specifier should be used for BOOL?

James Raitsev picture James Raitsev · Feb 27, 2012 · Viewed 7.2k times · Source

Possible Duplicate:
Objective c formatting string for boolean?

What NSLog %-specifier should be used to literally see YES or NO when printing a BOOL?

Answer

Emile Cormier picture Emile Cormier · Feb 27, 2012
BOOL var = YES;
NSLog(@"var = %@", (var ? @"YES" : @"NO"));

BOOL is merely an alias (typedef) for signed char.

The specifiers supported by NSLog are documented here.