C++Tutorial for Beginners 42 - Reversing a String (Interview Question!)

A favourite question of interviewers has long been "how do you reverse a string", without using any built-in subroutines. The popularity of the question owes much to the fact that they can actually ask you to do it, perhaps giving you ten or twenty minutes to come up with a solution, or getting you to sketch the answer on a board. You can reverse a string by just using a loop and a temporary variable, but here we'll take a look at a slightly more involved solution that uses pointers. If you can do this, you probably understand strings and pointers fairly well.

Click here to download source code for this tutorial.