Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

if (counter ) is the same as If (counter !=0)?

I’m learning c++, and I wanted to know whether the statement
"if(counter)" is the same as "if (counter!=0)"

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

If counter is a built-in primitive type (int, double, pointers), yes, it means the same thing. If it’s not a primitive type, they could mean completely different things (whatever operator bool and the comparator defined for comparing with something implicitly convertable from int happen to return).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading