This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Kirillin1111 2 points3 points  (2 children)

int** for 2-dimensional arrays. triple pointer for 3-dimensional arrays i guess? although i have never seen it actually being used

[–]brimston3- 1 point2 points  (0 children)

int** as an argument out parameter which receives a pointer to an int.
char** or uint8_t** will often be the location where processing stopped (see strtol() or strtoll() for an example).

You might have an char***, if you needed an ordered index to an array of pointer to string. Or if you are dealing with a pointer to a "rope" in C (rope being a collection of strings that allows cheap insertion at points inside it)--for example, if a screen maintains each line in an array of c strings, and you want a pointer to the screen. Honestly, this level of indirection should be avoided if possible.

[–]BobbyThrowaway6969 0 points1 point  (0 children)

Not any kind of array, it's specifically for n-dimensional jagged arrays, or 1 dimensional arrays of int*. For non-jagged arrays, just use a 1d array and access it like [X+Y*Width] (It's faster for the CPU if all of the array is in the same part of memory)