7

I am trying to figure out why I can ++b a bool but not --b it

#include <stdio.h>

int main(void)
{
    bool b = false;
    ++b;
    --b; // error C2428: '--' : not allowed on operand of type 'bool'

    printf("%s %d", b ? "true" : "false", b);

    getchar();
    return 0;
}
y2k
  • 64,108
  • 26
  • 59
  • 85

0 Answers0