Explore BrainMass

Pointer and array data structure in C++

Let us say that ip is a pointer pointing to an item in an integer array. Which of the following expressions point to the valid items within the array? ip[-2] or ip[2]? Why?

Solution Preview

The index of an array must be non-negative integer. So:

ip[-2] is ...

Solution Summary

Pointer to an array is investigated. The response was rated '5/5' by the student who posted the question originally.