Ad
  • Custom User Avatar

    Pretty sure that modern compilers will optimise this away, as long as the length of the string isn't changed in the loop (or declaired as volatile).

  • Custom User Avatar

    Well, that was painfull. Not a huge fan of traps like this, but lesson learned.

  • Custom User Avatar

    SOLVED: Apparently there was an off-by-one error in the for loop reversing the words. This led to undefined chars being appended at the front of each word (probably null bytes). It seems like std::cout ignores null bytes, as it uses the length of the container class std::string to terminate that string, therefore printing it correctly.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution