Download C++: A Beginner`s Guide, Second Edition

Transcript
The process works like this. As long as the start pointer points to a memory location that is less than the
end pointer, the loop iterates. Inside the loop, the characters being pointed to by start and end are
swapped. Then start is incremented and end is decremented. When end is greater than or equal to start,
all of the characters in the string have been reversed. Since both start and end point into the same
array, their comparison is meaningful.
5. Here is the complete StrRev.cpp program:
36
C++ A Beginner’s Guide by Herbert Schildt