How to convert the output of bool in from of 1's and 0's to string say True or False.
float a=get_float("Give 1st side");
float b=get_float("Give 2nd side");
float c=get_float("Give 3rd side");
bool z=trcheck(a,b,c);
printf("The Triangle is %d",z);
How to convert the output of bool in from of 1's and 0's to string say True or False.
float a=get_float("Give 1st side");
float b=get_float("Give 2nd side");
float c=get_float("Give 3rd side");
bool z=trcheck(a,b,c);
printf("The Triangle is %d",z);
A bool
in C is basically an integer underneath, which maps 0
to false
and 1
to true
¹. Using printf("%d", z)
on that value, will give you the numerical representation.
If you want a textual representation, you will have to provide that yourself, an example would be:
printf("%s", z?"true":"false");
but there are many ways to do this.
¹ Of course, it is not that simple, check out these links for more information.