Check this out:
The variable x is an int.
The variable x is an int, the variable y is an int.
The variable x is an int, the variable y is an int, the variable *z is an int.
The variable x is an int, the variable y is an int, the variable *z is an int, the variable **p is an int.
The variable x is an int, the variable y is an int, the variable *z is an int, the variable **p is an int, the variable *** q is an int.
So far so good?
OK. Let's take the variable z. In order for *z to be an int, the variable z itself ,must contain the address of that int. z is called a pointer. The * is called the dereference operator. So, you put the address of the int in z, then code *z to tell the compiler to go to the address in z and use the int at that address. Hence, *z is an int.
Let's suppose you have a poem in an array. Each line of a poem is a string expressed as a char array. Since a char array for a line is seen as a char* (remember the name of an array is the address of element 0), the poem becomes an array of pointers to char, or char*
- char* poem[5]; //a poem of five pointers
Here is the important thing: The name of an array is the address of element 0. Therefore, the name "poem" is the address of a char*. Therefore, poem is a char**.
Hence, *poem is a char*. Hence *poem is line 1 of the poem. Hence *(poem +1) is line 2 of the poem, *(poem +2) is line 3 of the poem, etc...
If the poem is put into a book of poems you have an array of pointers-to-pointers-to-char, or char**:
- char** book[5]; //a book of 5 poems.
-
To add the poem to the book, remember the name book is the address of book[0]. Therefore, *book is book[0]. Therefore:
- *book = poem; //add poem ADDRESS to book[0].
-
You can use the book array to display a line of the poem. Since book is the address of element 0, then *book is element 0 (the poem) and **book is line 1 of the poem.. The ADDRESS of second line of the poem would be *book +1 making the second line itself *(*book + 1).
This can be expanded to a array of poetry books:
- char*** bookset[5]; //array of 5 books.
-
I will leave the rest to you to access a line of the poem using the bookset array.