+ 1

why C does not have a boolean type ?

why C does not have a boolean type ?

12th Mar 2022, 10:46 AM
Collins Y Owiso
Collins Y Owiso - avatar
5 Respostas
12th Mar 2022, 11:10 AM
Ipang
+ 7
It has : _Bool b = 1; It stores either 1 or 0 as boolean value edit: #include <stdio.h> int main() { _Bool b = 1; if(b) printf("boolean"); return 0; }
12th Mar 2022, 10:59 AM
Jayakrishna 🇮🇳
+ 5
Just for fun prior to stdbool.h #include <stdio.h> //define boolean values #define TRUE 1 #define FALSE 0 int main(void){ int i = 3; int flag = FALSE; //set boolean flag if(i == 3){ flag = TRUE; } printf("%i\n", flag); } output: 1
12th Mar 2022, 12:14 PM
William Owens
William Owens - avatar
+ 3
Thank you
12th Mar 2022, 11:07 AM
Collins Y Owiso
Collins Y Owiso - avatar