"Yes."
Ditto. Yes with quotes around the word "yes". The phrasing of this sentence is a bit loose and inaccurate.I'm unsure of how declaring **x (a pointer to a pointer of x) is the same as declaring x[][] (a two-dimensional array of x's)... The theory I have is this:
**x is a pointer to a pointer to an integer not "a pointer to a pointer of x", and you can have a two-dimensional array of integers, but you can't have a two-dimensional array of x's
x[][] and **x are definitely not the same, but when used to dereference addresses, can accomplish the same thing.
#include<iostream>
using namespace std;
int main ()
{
int y[4];
y[0] = 5;
y[1] = 10;
y[2] = 15;
y[3] = 20;
int *x = y;
int *z = x + 2;
cout << *z << endl;
cin.get ();
return 0;
}
Here's an example, though it is a one-dimensional example, not a two-dimensional example. The line in red is an example of pointer arithmetic. The program will output 15.
VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711