Pergunta de entrevista da empresa Digital Extremes

Find as many bugs with the existing code as you can. There are several subtle but common errors throughout the code. It compiles, and runs, but would not stand up to production use. For bonus marks, add a few statements here-and-there to make the code more quick to detect errors. You can impose any reasonable restrictions on how the functions can be used and abused. Halting the program on error illegal input is acceptable in most cases, but use your judgement for deciding when it isn't appropriate.