Knorr-Bremse interview question

it was a cpp/c problem but easy.