The reverse() Algorithm

Another useful STL algorithm is reverse(). This algorithm reverses the order of elements in a specified sequence. reverse() takes two iterators that mark the sequence's beginning and end, respectively. Here is an example of reversing the order of a char array: