If I have an array of const doubles and I want to create a pointer which points to the nth element in the array, how would I do this? What about the 0th element in the array? Could I create a for loop that loops from the 0th element of the array to the nth element of the array if I had those two pointers?
Could I create a for loop that loops from the 0th element of the array to the nth element of the array if I had those two pointers?
Yes:
1 2 3 4
for( ; Begin <= End; ++Begin )
{
// Do something...
}
Edit:
I should say that the pointer must be constant if the array is an array of constant objects. If the pointer wasn't constant, it would break the rules of const, which the compiler frowns upon.