[Solved] operand types are incompatible (“bool (*)()” and “bool”) [closed]


playerCheck is a function which needs to be called in order to get the boolean result, i.e.:

if (playerCheck() == true)

bool (*)() is a type for a function which takes no arguments and returns a boolean.

playerCheck == true is an attempt to compare the function pointer with a boolean value, which leads to the compilation error which speaks for itself.

playerCheck() == true is calling the function and comparing the result (of type boolean) with the boolean value.


Note that if (x == true) can be generally abbreviated to if (x), so you could just write

if (playerCheck())

4

solved operand types are incompatible (“bool (*)()” and “bool”) [closed]