Jump to content

Creating an Array: Difference between revisions

Line 222:
=={{header|C++}}==
Using dynamically-allocated (i.e. [[Heap]]) memory:
(Warning, deprecated and not safe)
<lang cpp> const int n = 10;
int* myArray = new int[n];
Line 235 ⟶ 236:
<lang cpp> int myArray2[10] = { 1, 2, 0}; /* 3..9 := 0 */</lang>
 
Using boost::array
<lang cpp> boost::array<int,3> myArray2 = { 1, 2, 0}; </lang>
{{libheader|STL}}
<lang cpp> // STL
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.