27.2.08

Boolean type

C99 supports _Bool keyword, which declares a two valued ( '0' or ' 1 ') integer.

Code snippet:

_Bool x; /* x will contain either ‘0’ or ‘1’.*/

x = 0;


Another way

include the header stdbool.h , it provides bool same as _Bool ( typedef ) and

two macros true and fase.

Code snippet:

#incldue "stdbool.h"

bool flag;

flag = true; /* flag value is true which is 1 */

flag = false; /*flag value false which is 0 */