I saw one example

int x = 10;
int y = 5;

bool isGreater = x > y;

printf("%d", isGreater);

But I could write this

int x = 10;
int y = 5;

printf("%d", x > y);

I am a complete beginner and I have no real reason why I would or would not want to deal with boolean variables, but I want to understand their raison d’être.

Edit: typo city

  • durinn@programming.devOP
    link
    fedilink
    English
    arrow-up
    3
    ·
    1 day ago

    Thanks! I did indeed see a reference somewhere, saying that it makes the code easier to read too. :)