Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
doc_src_qvarlengtharray.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
5int myfunc(int n)
6{
7 int table[n + 1]; // WRONG
8 ...
9 return table[n];
10}
12
13
15int myfunc(int n)
16{
17 int *table = new int[n + 1];
18 ...
19 int ret = table[n];
20 delete[] table;
21 return ret;
22}
24
25
27int myfunc(int n)
28{
29 QVarLengthArray<int, 1024> array(n + 1);
30 ...
31 return array[n];
32}
34
35
37QVarLengthArray<int> array(10);
38int *data = array.data();
39for (int i = 0; i < 10; ++i)
40 data[i] = 2 * i;
QVarLengthArray< int > array(10)
[2]
int myfunc(int n)
[0]
return ret
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfloat n
GLenum array
GLenum GLenum GLsizei void * table