is 1 true or false in C + +?

Source: Internet
Author: User

Today would like to look at the reference C + +, and then see the online question C + + 1 is true or false? With vc6.0 is a bit, is true. vc6.0 should be non-0 is true,0 to false. Java I have also tried, if (1) This statement compilation can not pass, in Java if () can only put a Boolean type of variable.

1#include <iostream>2 3 using namespacestd;4 voidChangeflag (BOOL&flag);5 6 intMain ()7 {8     BOOLFlag =true;9 changeflag (flag);Ten     if(- +) Onecout<<"-1 is True"<<Endl; A     Else -cout<<"-1 is False"<<Endl; -  the      -cout<<"flag ="<<flag<<Endl; -  -     return 0; + } -  + voidChangeflag (BOOL&flag) { AFlag =!Flag; at}

PS: please call me soy sauce little Prince, I am so bored

is 1 true or false in C + +?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.