Wednesday, April 1, 2009

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:

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 in C++Builder are:
char, float , signed, wchar_t,
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.

No comments:

Post a Comment