Home > Common Problem > what does true mean

what does true mean

little bottle
Release: 2019-05-23 09:12:48
Original
37894 people have browsed it

There are many words in computer programming languages ​​that have special meanings, such as false and true. Do you know what they generally mean? Please listen to what the editor tells you below.

In fact, true in programming languages ​​is generally defined as "true", while false represents "false". They are usually used to judge or mark a certain variable.

Please look at the following piece of code:

#include <iostream>
using namespace std;
void changeFlag(bool &flag);
int main()
{
    bool flag = true;    //用true对flag进行标记
    changeFlag(flag);
    if(-1000)            //判断—1000是否为不为0
        cout<<"-1 is true"<<endl;
    else
        cout<<"-1 is false"<<endl;
    cout<<"flag = "<<flag<<endl;
    return 0;
}
void changeFlag(bool &flag){
    flag = !flag;
}
Copy after login

Running results:

what does true mean

The above is the detailed content of what does true mean. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template