Creating an Array: Difference between revisions
Content added Content deleted
(→{{header|Python}}: Add ctypes arrays, and struct.) |
(→{{header|C++}}: modified STL example (it was misleading as it was; I guess the Qt and MFC entries should be changed, too)) |
||
Line 194: | Line 194: | ||
{{libheader|STL}} |
{{libheader|STL}} |
||
<lang cpp> // STL |
<lang cpp> // STL |
||
std::vector<int> myArray3(10); |
std::vector<int> myArray3(10); // make array with 10 elements, initialized with 0 |
||
myArray3[0] = 1; // set first element to 1 |
|||
myArray3.push_back(1); |
|||
myArray3[1] = 2; // set second element to 2 |
|||
myArray3.push_back(2);</lang> |
|||
myArray3.push_back(11); // append another element with value 11 |
|||
myArray3.push_back(12); // append another element with value 12 |
|||
// now myArray has 12 elements: 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 11, 12 |
|||
</lang> |
|||
{{libheader|Qt}} |
{{libheader|Qt}} |