Data types in C + +

Source: Internet
Author: User

1.intint is the machine byte length, the number of int's memory space in 16-bit system is 2 bytes, in 32-bit system is 4 bytes, in 64-bit system is 8 bytes. such as: DOSint=2bytesLong=4byteswindowsint=4bytesLong=4Bytesvistaint=8bytesLong=4bytessizeof( Short) <=sizeof(int) <=sizeof(Long) 2. The difference between bool and Boolbool and bool: I.1, different types bool is int type bool is Boolean type2, length different bool only one byte bool length depending on the actual environment, generally can be considered to be 4 bytes3, value different bool value false and True, is the difference between 0 and 1 bool value false and True, is the difference between 0 and non 0 two: bool is the standard C++data type, the desired value is true and false.    A single byte, if a number of bool objects are listed together, may occupy a bit, depending on the compiler. BOOL is a typedef defined by MicrosoftintBOOL. Unlike bool, it is a three-valued logic, TRUE/false/error, an integer with a return value of >0 is true,0 to false,-1 is error. Tip1:windows the underlying variables defined for compatibility issues. The resolver is in C and C++differences in the environment: typedef unsignedLongDword;typedefintbool;typedef unsignedCharbyte;typedef unsigned ShortWord;typedeffloatfloat;typedef FLOAT*pfloat;typedef BOOL near*Pbool;typedef BOOL far*lpbool;typedef BYTE near*Pbyte;typedef BYTE far*Lpbyte;typedefintNear *Pint;typedefintFAR *LPINT;TIP2:MFC Data types: These are the data types that are used in conjunction with the WIN32 program bool: A Boolean value that evaluates to TRUE or FALSEBSTR: +-bit character pointer byte:8-bit integer, unsigned colorref: +-a bit value that represents a color value DWORD: +-bit integer, unsigned long: +-bit integer with sign lparam: +-a bit integer, as a parameter to the window function or callback function LPCSTR: +-bit pointer, pointing to a constant string LPSTR: +-bit pointer, pointing to a string LPCTSTR: +-bit pointer, which points to a constant string that can be ported to Unicode and DBCSLPTSTR: +-bit pointer, pointing to a string that can be ported to Unicode and dbcslpvoid: +-bit pointer, pointing to an unspecified type of data lpresult: +-bit value, as the return value of a window function or callback function UINT: In Win16 is a-bit unsigned integer, in Win32 is a 32-bit unsigned integer, WNDPROC: +-bit pointer, pointing to a window function word: --bit integer, unsigned wparam: A parameter of the window function or callback function, in Win16-bit, in Win32, is 32-bit below these are MFC's unique data types position: A numeric value that represents the position of an element in an collection object (such as an array or a linked list), commonly used in MFC collection classes (that is, the data processing class, such as CArray) Lpcrect: +-bit pointer, pointing to an immutable rect structure
Reprinted from:

Data types in C + +

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: 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.