What does mean in C 4

The author is using one method (not the only) in C of creating two-dimensional array of doubles, namely, creating Y one-dimensional arrays of double, and a single array of X pointers to these. Each of those Y arrays is accessed by a variable of type . Then he creates a single one-dimensional array of pointers to each of these arrays, and stores those pointers in an array of type , or pointer-to-pointer-to-double.

There are several advantages of using this method to make 2D arrays. One, you need to do less math to reach an element, and you can even pass such arrays to functions that don't have to know their exact dimensions to work. Also, you can create things like triangular arrays, or other shapes where the sub-arrays need not all be the same size.

The only downside is that they take up a bit more memory.

answered Feb 10 '15 at 22:23

Lee Daniel CrockerLee Daniel Crocker

11.5k11 gold badge2121 silver badges4343 bronze badges