RAD Studio |  |

Type Specifiers

The type determines how much memory is allocated to an object and how the program interprets the bit patterns found in the object's storage allocation. A data type is the set of values (often implementation-dependent) identifiers can assume, together with the set of operations allowed on those values.

The type specifier with one or more optional modifiers is used to specify the type of the declared identifier:

Copy Code

    int i;                   // declare i as an integer
    unsigned char ch1, ch2;  // declare two unsigned chars

By long-standing tradition, if the type specifier is omitted, type signed int (or equivalently, int) is the assumed default. However, in C++, a missing type specifier can lead to syntactic ambiguity, so C++ practice requires you to explicitly declare all int type specifiers.

The type specifier keywords by the CodeGear C++ compiler are:

char wchar_t | float | signed
class | int | struct
double | long | union
enum | short | unsigned

Use the sizeof operators to find the size in bytes of any predefined or user-defined type.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!