Jump to content

C++ Language/Variables/Initialization

From Wikibooks, open books for an open world

A constant variable (marked by the const keyword) must be initialized. If a static-lifetime variable is not manually initialized, then it will be automatically initialized to 0. If a local object variable is not manually initialized, then its default-constructor will construct it. If a local primitive variable is not manually initialized, then its value will be undefined until something gets assigned to it.

Additional information about initialization (includes interactive examples)