#include "d:\Practice Programs\Puzzle Feuer\Puzzles\defs.h" // win 98 is 32 bit platform. So int is 32 bit. // a[row][column] int a[3][3] = { {1, 2, 3 }, {4, 5, 6 }, {7, 8, 9 } }; /* a points to start of array, *a points to start of array, **a points to first element of array, *a[0] points to first element of array. *(*(a+n)+m) == a[n][m] will give array element. a[n] will give address of n row in the array. a[1] will point to start of row 1 -> {4, 5, 6} pa is a pointer to an array pointers. The pa pointer array has the address of the 3 rows of int array a. pa[n] holds the address of the n row of int array a. p holds the starting address of int array a. So *(p+n) will give the n member of int array a, as the n value will act as a memory off set, but *p+n will the first array value + the value of n. All ways keep "Precedence and Asociativity of Operators" in mine. See Kernighan and Ritchie. p is an int pointer that has the address of the start of the int array a. *p == p[0], *(p+n) n acts as a memory off set to give the p+n member of the int array a. (*p)+n will add the value n to the first member of the array. SEE END OF THIS FILE FOR ARRAY DISCRIPTION. */ int *pa[3] = { a[0], a[1], a[2] }; int *p = a[0]; void main() { int i; for( i=0; i<3; i++ ) PRINT3(d, a[i][2-i], *a[i], *(*(a+i)+i) ); // Will give addresses PRINT3(x, &a[i][2-i], &a[i], &(*(*(a+i)+i)) ); NL; for( i=0; i<3; i++ ) PRINT2(d, *pa[i], p[i] ); }// end main /* int a[3][3] = { {1, 2, 3 }, {4, 5, 6 }, {7, 8, 9 } }; Remember memory is just one long string of bits. When the program initializes 'int a[3][3]' it is asking for a contiguous piece of that string that is 9 int (in this platform 32 bit) long. The array a[n][m] is C's way of using memory off set addressing to access member of that array. n*m tells how many array members, how meny memory locations to allocate. n = number of sub sections in the memory allocation, and m = number of members in that subsection. This is how *(*(a+n)+m) will give access to same array member as a[n][m]. *(a+n) gets to starting address of n subsection and *(subsection start)+m) gets to the m member in that subsection. pa is a pointer array of the subsections of the a int array. by using pointer indirection *(*(pa+n)+m) you can access the subsection members. So a[n][m] == *(*(pa+n)+m), but this does not convert to Do not make the mistake a[n][m] == *(*(a+n)+m) == *(*(pa+n)+m) != *p+n*m != *(p+n*m) As a[2][2] give access to the 8 th member of the array value 9. as *p+2*2 == *p+4 == a[1][1] the 4 th member of the array 5. With arrays the first member is the 0 th (zero th.) 1 ->a ->a[0] ->a[0][0] *p *pa 2 ->a[0][1] *(p+1) 3 ->a[0][2] *(p+2) 4 ->a[1] ->a[1][0] . *(pa+1) 5 ->a[1][1] *(*(pa+1)+1) 6 ->a[1][2] 7 ->a[2] ->a[2][0] *(pa+2) 8 ->a[2][1] . 9 ->a[2][2] *(p+8) *(*(pa+2)+2) Is in memory */