Home Segments Index Top Previous Next

345: Mainline

Because the value of number is the address of the first element in the number array, number is viewed as a pointer. Accordingly, you can produce the addresses of other array elements using number in addition expressions:

number + 0         /* Address of the first element */ 
number + 1         /* Address of the second element */ 
... 
number + n - 1     /* Address of the nth element */ 

Once you know how to produce addresses from number, you know how to produce the elements themselves via the dereferencing operator:

*(number + 0)      /* Identifies the first element */ 
*(number + 1)      /* Identifies the second element */ 
... 
*(number + n - 1)  /* Identifies the nth element */ 

Thus, *(number + n) identifies the same element as number[n]. The bracket notation is just a shorthand for the addition-cum-dereferencing combination.