Life is really, truly, honestly, ever so much easier if you work with writing your own code instead of trying to understand some other random person’s on the internet. (If I am reading that code correctly, it reverses (?) a word the least straight-forward way possible.)
translating is almost always a failure.
- if the code is really small and simple, its better to rewrite it using the other language's strong points and styles.
- if the code is larger and complicated, the task quickly becomes impossible as you run into things that can't be done or can't be done the same way in the other language and require exotic work-arounds, for example overloaded operators in c++ going back to java would be hair-pulling. A very simple (half page) CRC in c++ turned into a fair hassle in java due to its screwy shoehorned in after the fact support for unsigned/bitwise math.
And you can see that is what happened here -- the help is all do-over correctly in c++ rather than attempts to 'translate' it.