Return bool or 1/0 | Sololearn: Learn to code for FREE!


Return bool or 1/0

What would be the correct (or more efficient) way to return a value of a function?

3/27/2018 4:08:36 PM

Marfik Em

2 Answers

New Answer


If you just need true or false then use bool. Bool takes 1 byte, while int uses 4. Doesn't make that much difference in efficiency on most systems, but it also makes your code more readable in my opinion.


most programming languages use boolean, but for example in C you don't have boolean so you can use 1 for true and 0 for false