Rahul Nasit
can you find the error if found then re write this on blog

#include<stdio.h>
#include<conio.h>
void printf_bool (bool value)
{
value = true ? printf("true\n":printf("false\n";
};
void main()
{
int x=10,y=20;
printf("x=%d\n",x);
printf("y=%d\n",y);

bool result = (x!=y);
printf(" bool result = (x!=y);";
printf_bool (result);

bool result = (x>y);
printf(" bool result = (x>y);";
printf_bool (result);

bool result = (x<y);
printf(" bool result = (x<y);";
printf_bool (result);

bool result = (x>=y);
printf(" bool result = (x>=y);";
printf_bool (result);

bool result = (x<=y);
printf(" bool result = (x<=y);";
printf_bool (result);

getch();
Like · Comment ·
Dhruvin Shah likes this

Admin

#include<stdio.h>
#include<conio.h>
void printf_bool (int value)
{ value = value ? printf("true\n":printf("false\n";
}
void main()
{ int x=10,y=20,result;
printf("x=%d\n",x);
printf("y=%d\n",y);
result = (x!=y);
printf(" bool result = (x!=y);";
printf_bool (result);
result = (x>y);
printf(" bool result = (x>y);";
printf_bool (result);
result = (x<y);
printf(" bool result = (x<y);";
printf_bool (result);
result = (x>=y);
printf(" bool result = (x>=y);";
printf_bool (result);
result = (x<=y);
printf(" bool result = (x<=y);";
printf_bool (result);
getch();
}
Like · 2 ·

Admin

C language does not support any bool type declaration... You can use int instead of bool to store result value which is 0 or 1.. if you have any query regarding this answer you are free to ask us...
Like · 3 ·

Rahul Nasit

thanks
Like ·

Rahul Nasit

why bool is not used in c
Like ·
Download Android App