-1

Actually I came across a problem where I want to print the return value of a function but it is true or false. SO, how can I point out a bool.

For example, %c = for char %i = for integer but what is for bool type

 bool s = valid_triangle(x, y, z);

printf("%u\n",s);
return 0;
}

Thank you in advance!

geebert
  • 285
  • 3
  • 10
  • 1
    Why does your title ask about a “pointer”? Did you mean to ask something about “printing”? A correct title could be “What printf conversion specifier should be used for bool?” – Eric Postpischil Jan 02 '21 at 13:06

1 Answers1

0

In C the name bool is an alias of the type _Bool. It is an integer type. You may use for example the conversion specifier d or i to output either 1 or 0 of an object of the type bool due to the integer conversions because the rank of the type _Bool is less than the rank of the type int..

Vlad from Moscow
  • 301,070
  • 26
  • 186
  • 335