]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/gcc/extensions-to-the-c-language-family/pointers-to-arrays-with-qualifiers-work-as-expected.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / doc / gcc / extensions-to-the-c-language-family / pointers-to-arrays-with-qualifiers-work-as-expected.rst
1 ..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6 .. index:: pointers to arrays, const qualifier
7
8 .. _pointers-to-arrays:
9
10 Pointers to Arrays with Qualifiers Work as Expected
11 ***************************************************
12
13 In GNU C, pointers to arrays with qualifiers work similar to pointers
14 to other qualified types. For example, a value of type ``int (*)[5]``
15 can be used to initialize a variable of type ``const int (*)[5]``.
16 These types are incompatible in ISO C because the ``const`` qualifier
17 is formally attached to the element type of the array and not the
18 array itself.
19
20 .. code-block:: c++
21
22 extern void
23 transpose (int N, int M, double out[M][N], const double in[N][M]);
24 double x[3][2];
25 double y[2][3];
26 ...
27 transpose(3, 2, y, x);