Types and Declarations (C++)

Initialization
If an initializer is specified for an object, that initializer determines the initial value of an object. If no initializer is specified, a global, namespace, or local static object is initialized to 0 of the appropriate type.

Local variables (//automatic objects//) and objects created on the free store (//dynamic objects// or //heap objects//) are not initialized by default.

More complicated objects require more than one value as an initializer. This is handled by initializer lists delimited by { and } for C-style initialization of arrays and structures. For user-defined types with constructors, function-style argument lists are used.

Typedef
A declaration prefixed by the keyword typedef are synonyms of other types rather than distinct types. They can be a convenient shorthand for a type with a unwieldy name. For example, unsigned char is too long for really frequent use, so we could define a synonym, uchar:

Another use is to limit the direct reference to a type to one place. For example:

If we now use int32 wherever we need a potentially large integer, we can port our program to a machine on which sizeof(int) is 2 by redefining the single occurence of int in our code: