Case 3 means you can do this.
int arr[10];
int *pStart = arr;
int *pEnd = &arr[10]; // one past the end
while ( pStart < pEnd ) {
pStart++;
}
Note that whilst you can POINT to the element just off the end of the array, any attempt to dereference pEnd would be undefined behaviour.
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Offline 7,164 posts
since Dec 2005