bool assigning

What happens when a bool value is assigned to char value??the bool value takes 1 or 0 for char value??and why??
> What happens when a bool value is assigned to char

The char is assigned char(1) (true) or char(0) (false)
The bool is implicitly converted to a char.


> and why??

Why should anyone want to assign a bool value to a char?

If you do: bool b = ... ; char c = b ; if(c) would behave like if(b)



Last edited on
Topic archived. No new replies allowed.