Saturday, April 24, 2010

Arrays and Pointers

The following code is valid:
int *pMyInt = new int[10];
9[pMyInt] = 1;

Because, pMyInt[9] equals *(pMyInt + 9) which equals *(9 + pMyInt) which equals 9[pMyInt].

No comments:

Post a Comment