Basic data types for C + +

Source: Internet
Author: User

A basic data:

(1)整型:                                        short 至少16 位                                        int 至少与short长度相同                                        long 至少32位,至少与int一样长                                        long long 至少64位,至少与long一样长(2)浮点数:                                        float 至少32位                                        double 至少48位(主流为64位)                                        long double 至少与double相同

Two data limitations:
Restrictions on data types on different platforms need to be viewed using Limits.h or climits header files

        Symbolic constant meaning Char_bit                                           The number of bits of char Char_max the maximum value of char Char_min                                        The minimum value of char Schar_max the maximum value of signed Char Schar_min        Signed char minimum value Uchar_max unsigned char maximum Shrt_max short Type maximum value shrt_min short                                             The minimum value of the type Ushrt_max the maximum value of the unsigned short type Int_max                                           The maximum value of the integral type Int_min the minimum value of the integer Unit_max                                          Maximum value of the unsigned integer long_max LONG long_minThe minimum value of long ulong_max the maximum value of the unsigned long Llong_max                                    The maximum value of long long llong_min the minimum value of long long Ullong_max Unsigned long Long's maximum value PS: see/usr/include/limits.h for more details

Three data suffixes:
To explicitly declare the type of a constant, you add a suffix at the end of the constant, and the type of the default constant is int

                 L :      long      (对于double 使用L)                 U :     unsigned                  LL:    long long                 F:      float

Four about coercion type conversions:

                        c 类型形式:      (type) var_or_const                        c++    形式:         type ( var_or_const )                        c++    形式:         static_cast<type>( var_or_const)

Basic data types for 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.