Hello,
I don't understand this question in the book I'm reading.
Write a function void copy(int* f1, int* e1, int* f2) that copies the elements of an array of ints defined by [f1:e1) into another [f2:f2+(el-fl)). Use only the iterator operations mentioned above (not subscripting).
If someone could explain [f1:e1) and [f2:f2+(el-fl)) I think I could solve this problem.
I understand '(' excludes and '[' includes but I don't understand the combinations of two different iterators. I usually use them in math for sequencing but it seems a little different in programming.
[f1:e1) sets a range of iterators that incluudes f1 and excludes e1. Moreover pointer e1 is reachable from pointer f1. It means that if we would increase f1 then after some steps f1 will become equal to e1.
So how many steps do we need that f1 become equal to e1? This number is e1 - f1. So when f1 will be changed from its initial value f1 to end value e1 at the same time f2 will be changed from its initial value f2 to f2 + ( e1 - f1 ).