Content deleted Content added
Default initialization |
|||
Line 1:
{{mergeto|Declaration (computer science)}}
In [[computer programming]], '''initialization''' is the assignment of an initial value for a [[data object]]. The way how initialization is performed depends on [[programming language]], as well as type, [[storage class]], etc., of an object to be initialized.
Programming constructs which perform initialization are typically called '''initializers''' and '''initializer lists'''. ==C family of languages==
Line 16 ⟶ 18:
-->
:int i = 0;
:int i2(0);
:int k[4] = {0, 1};
:int j[2] = {rand(), k[0]};
Line 33 ⟶ 36:
The coming new C++ standard, [[C++0x]], provides for a [[C++0x#Initializer_lists|more powerful concept of initializer lists]], by means of a template, called <tt>std::initializer_list</tt>.
===Default initialization===
Data initialization may occur without explicit syntax in a program to do so' For example, if [[static variable]]s are declared without an initializer, then those of [[primitive data type]]s are initialized with the value of zero of the corresponding type, while static objects of class type are initialized with their [[default constructor]]s.
==References==
|