Another way to explain pfft's code: it simply reverses the arrow between every 2 adjacent nodes. Calling nodes by their order in the original list, out comes just before in, and the code swaps in->next accordingly.

Two conceptually different explanations for the same routine.