The above example shows a somewhat esoteric method called Iliffe vector , which is one of the possible ways to implement jagged arrays in C. An uneven array is a matrix in which each row has a different length.
Since arrays are one-dimensional in C, you create a single linearA array containing all elements, which is interpreted as a sequence of strings, each of which has a different size. The pointer array A contains pointers to the first element of each row, which allows you to access elements using row and column indexes.
The code displays several interesting features of C pointers and arrays:
linearA + 5
Pointer arithmetic: adding an integer to a pointer (or array) gives a pointer indicating n elements after the original pointer.
A[3][2] = 3.66;
This good syntax allows you to think of this structure as a two-dimensional matrix.
In addition, and this is probably the highlight of the example, pointers and arrays are interchangeable. Here A[3] is a pointer to a float, since A is defined as an array of pointers to a float; adding [2] gives us an element of 2 places after the pointer indicated by the pointer of the original. This is similar to the arithmetic of the pointer above, only in this case the pointer is dereferenced. In fact, access to the array is defined in terms of pointers, so X[5] equivalent to *(X+5) .
A[3][-3]
This shows that nothing prevents you from accessing an item outside of this line. In this case, you get access to the element 3 of the place before that pointed to by A[3] . This is something that is rarely required, and it only works in this case, because you built the matrix to have adjacent elements. Typically, accessing elements outside the allocated array range will cause your program to crash.
Finally, to answer your question:
And A[1] = linearA + 5; - 6 elements per line - for the same reason? Shouldn't A[1] be a pointer to the 6th member of linearA ?
Because pointers and arrays are interchangeable, A[1] is a pointer to the sixth element in linearA and an array starting from the sixth element in linearA . There is nothing in this language, saying that the last of the 6 elements is long, you must implement this logic in your code.