Help! Not understanding Data Structures Code Examples

I am a newbie in C++ and recently reading the coding examples online, then I found the followings:

1
2
3
4
5
6
7
8
9
10
11
12
13
  class graph
{
	private:int n;
		int **a;
		int *reach;
		int *pos;
	public:graph(int k=10);
		void create();
		void dfs();
		void dfs(int v,int label);
		int begin(int v);
		int nextvert(int v);
};


I do not understand what ** stands for. I know * referring to pointer, but **...

Please anyone help me.
int a; is an int.
int *a; is a pointer to an int.
int **a; is a pointer to a pointer to an int.
@lachlan Easton
so therefore,
string *a is a pointer to a string?
and **a pointer to a pointer to a string?
Yes. Pointers to pointers aren't used as often as singular pointers, but they can be useful. You should really only use a pointer to pointer if you know exactly why it is you need it.
@Lachlan Easton
So when and why do we use the pointer of the pointer??
So when and why do we use the pointer of the pointer??
Right now I can think of two occasions:

As a parameter to a function: You want to modify the pointer pointed to.
As a dynamic 2d array.
Also, pointers aren't limited to only two levels. It can be as much as you want:
 
int******************a;

So when and why do we use the pointer of the pointer??


A good example would be for creating dynamic arrays to use in spreadsheets
Topic archived. No new replies allowed.