BOOL and bool

Source: Internet
Author: User

 

1. Different Types

BOOL is an int type and is a Microsoft custom type: typedef int BOOL;

Bool is a boolean type and is a C ++ standard data type.

2. Different Lengths

The BOOL length depends on the actual environment. Generally, it is 4 bytes, because it is of the int type;

Bool is 1 byte in length.

3. Different values

BOOL values are FALSE and TRUE, which are the difference between 0 and non-0;

Bool values are false and true, which are the difference between 0 and 1.

1. // example

2. BOOL a = 1; // correct

3. BOOL a = 3; // correct

4. bool a = 1 // correct

5. bool a = 3 // warning

 

 

This article is from the "liangbing" blog

Related Article

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.