المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Using float to define boolean type in C



C++ Programming
05-07-2009, 04:22 PM
Folks, I know we can use unsigned/signed int and char to define our own Boolean type in C. We can either use 0 or 1 to distinguish FALSE or TRUE or use TRUE as anything which is non-zero.

Why can't I use float data type to define my own boolean type?

Can I use the zero and no zero concept using float and define my boolean type using it?