visual c fundamental types

Upload: andrei-botnari

Post on 04-Jun-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 Visual C Fundamental Types

    1/2

    Visual C++ Fundamental Types

    Fundamental types in C++ are divided into three categories: integral, floating, and void. Integral

    types are capable of handling whole numbers. Floating types are capable of specifying values

    that may have fractional parts.

    The voidtype describes an empty set of values. o variable of type voidcan be specified ! it isused primarily to declare functions that return no values or to declare generic pointers to untyped

    or arbitrarily typed data.

    The following table e"plains the restrictions on type si#es. These restrictions are independent of

    the $icrosoft implementation.

    Fundamental Types of the C++ Language

    Category Type Contents

    Integral charType charis an integral type that usually contains members of the

    e"ecution character set ! in $icrosoft C++, this is %&CII.

    The C++ compiler treats variables of type char, signedchar, and

    unsignedcharas having different types. Variables of type charare

    promoted to intas if they are type signedcharby default, unless the

    '( compilation option is used. In this case they are treated as type

    unsignedcharand are promoted to intwithout sign e"tension.

    boolType boolis an integral type that can have one of the two values true

    or false. Its si#e is unspecified.

    shortType shortint)or simply short* is an integral type that is larger thanor eual to the si#e of type char, and shorter than or eual to the si#e

    of type int.

    b-ects of type shortcan be declared as signedshortor unsigned

    short. Signed shortis a synonym for short.

    intType intis an integral type that is larger than or eual to the si#e of

    type shortint, and shorter than or eual to the si#e of type long.

    b-ects of type intcan be declared as signedintor unsignedint.

    Signedintis a synonym for int.

    int n

    &i#ed integer, where nis the si#e, in bits, of the integer variable. The

    value of ncan be /, 01, 23, or 14. )__int nis a $icrosoft5specific6eyword.*

    longType long)or longint* is an integral type that is larger than or eual

    to the si#e of type int.

    b-ects of type longcan be declared as signedlongor

    unsignedlong. Signedlongis a synonym for long.

    longlong 7arger than an unsigned long.

    b-ects of type long longcan be declared as signedlong longor

    unsignedlong long. Signedlong longis a synonym for long long.

    Floating float Type floatis the smallest floating type.

    double Type doubleis a floating type that is larger than or eual to typefloat, but shorter than or eual to the si#e of type longdouble

    longdouble Type longdoubleis a floating type that is eual to type double.

    0

    http://msdn.microsoft.com/en-us/library/fxky5d0w(VS.80).aspxhttp://msdn.microsoft.com/en-us/library/fxky5d0w(VS.80).aspx
  • 8/13/2019 Visual C Fundamental Types

    2/2

    8ide5

    character__wchar_t

    % variable of__wchar_tdesignates a wide5character or multibyte

    character type. 9y default, wchar_tis a native type but you can use

    'c:wchart5to ma6e wchar_ta typedef for unsigned short.

    ;se the 7 prefi" before a character or string constant to designate the

    wide5character5type constant.

    0 The representation of long doubleand doubleis identical.