If statement format

kaveh rahimi 61 Reputation points
2021-09-20T13:40:23.677+00:00

Hi , I want to use if for a bool parameter how do I have to use it.
Is "if (CH341SetDeviceNotify=='true')" correct?
Please clarify me by an example.
Thanks

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,634 questions
{count} votes

2 answers

Sort by: Most helpful
  1. David Lowndes 4,711 Reputation points
    2021-09-20T13:46:51.773+00:00

    If CH341SetDeviceNotify is a bool, you just need:

    if (CH341SetDeviceNotify)
    

  2. WayneAKing 4,921 Reputation points
    2021-09-20T21:53:16.66+00:00

    You should keep in mind that BOOL and bool are not the same thing.

    Also TRUE/FALSE are not the same as true/false.

    What is the difference between BOOL and bool?
    https://stackoverflow.com/questions/6420526/what-is-the-difference-between-bool-and-bool

    • Wayne
    0 comments No comments