lack of readability and maintainability for those born after 1970
Do people born before 1970 know better to support unreadable code? If so, it’s good because I was, and this can only be a selling point.
before we decide whether to return this person to round 2, I would like to know if he has any features to redeem beyond the safety of the author.
There is no one ransom function s in the code. This bizarrely uses the xor exchange technique, the only possible buyback function of which would be to save the integer value of the stack. However, even this is negated with five pointers and an unused int. It also has free use of the comma operator.
I usually also say "goto, yuck", but in this case it was used quite elegantly as soon as you understand the sorting algorithm used. In fact, you can argue that it makes the gnome sorting algorithm more understandable than using an index variable (except that it cannot be generalized to n elements). So you have the temptation function, it makes goo look good :)
As for "you are returning the candidate for the second interview." If the code fragment was accompanied by a detailed commentary explaining how the algorithm works and the author’s motivation for using it, I would definitely say yes. If not, I would probably call him and ask these questions.
NB, the code snippet uses K & R style parameter declarations. This means that the author is probably not programmed in C for 10-15 years, or he copied it from the Internet.
Jeremyp
source share