Type Specifiers

From Appmethod Topics
Jump to: navigation, search

Go Up to Declaration Syntax Index

Description

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

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

Type Keywords

Specifier Keywords