If you have an array of 100 integers called
values, you can define a pointer called
valuesPtr, which you can use to access the integers contained in this array with the following statement:
When you define a pointer that will be used to point to the elements of an array, you don’t designate the pointer as type “pointer to array”; instead, you designate the pointer as pointing to the type of element contained in the array.
If you had an array of
Fraction objects called
fracts, you could similarly define a pointer to be used to point to elements in
fracts with the following statement:
valuesPtr to point to the first element in the
values array, you just write this:
valuesPtr = values; ...