I see no egregious typos. It is entirely done with C code, although you have cstdlib as a header, which is C++, so I assume you are using a C++ compiler. You might consider having the ball direction in a separate function altogether. Logic to detect where the ball is in relation to the position of the pong ball and change direction accordingly may make it more interesting.