What is the use of bool?

in the compare funtion we write it as bool type,but what is the use of bool? I re coded it with int rather than bool and it is still working. So is there any reason as to why we use bool, why cant we use int?

Using bool makes the code more readable and semantically clear, indicating a true/false condition explicitly.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.