This bouncing ball program in C teaches you how to create a simple bouncing ball game using computer programs. In the console interface, the ball keeps moving.
It reverses course when it comes into contact with the border. The ball is caught by the control stick, and the score is increased by one. The game is over if the ball is not caught.
Controlling the ball’s movement direction via a variable is crucial to the effect of the ball movement. This variable changes depending on the boundary encountered and its current value, therefore the direction of flight is in the exact opposite direction.
Then, to conclude the game, set the ball to only hit the lower boundary where the stick is positioned, rather than touching the lower boundary where the stick is located.
Bouncing Ball Game Code in C Language it include a free Download Source Code. Simply locate the downloadable source code below and click the “Download Now” button.
To start creating a Calculator in C Language, make sure that you have a Code Blocks or any platform of C installed in your computer.
| ABOUT PROJECT | PROJECT DETAILS |
|---|---|
| Project Name : | Bouncing Ball |
| Project Platform : | C/C++ |
| Programming Language Used: | C Programming Language |
| Developer Name : | itsourcecode.com |
| IDE Tool (Recommended): | Dev-C++/Codeblocks |
| Project Type : | Desktop Application |
| Database: | Stores data in .DAT file |
Bouncing ball code in C Steps on How to Create a Project
Time needed: 5 minutes
Here’s the step’s on how to create a Bouncing Ball in C with Source Code.
- Step 1: Create a new project.
First open the code blocks IDE and click “create a new project“.

- Step 2: Choose console application.
Next, click the “console application” and after that click “next“.

- Step 3: Choose C language.
Then , choose “C language” and click “next“.

- Step 4: Name your project.
Lastly, name the project you’ve created and click “next” after that click “finish“.

- Step 5: The actual code.
Finally, we will now start adding functionality to our C Framework by adding some functional codes.
This bouncing ball program in C was build and run under Code::Blocks IDE.
- This is the code to Define global variables in the system, the score board is for the number of squares eliminated, left and right for the boundary of keyboard.
int hight,width; int bouncingBall_X,bouncingBall_Y; int ball_bouncing_vertical_x,ball_bouncing_vertical_y; int pos_X,pos_Y; int radius; int left,right; int ball_number; int blocking_X,blocking_Y; int score_board;
- This is the function to hide the cursor(Bouncing Ball Game Project in C)
void HideCursor()
{
CONSOLE_CURSOR_INFO cursor_info = {1, 0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
}- Function to move the cursor to (x,y) position and clear screen function.
void gotoxy(int x,int y)
{
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
COORD pos;
pos.X = x;
pos.Y = y;
SetConsoleCursorPosition(handle,pos);
}- Function to change the color of the console.
system("color 9f"); Downloadable Source Code
Conclusion
In Conclusion, Developers have always a strong desire to create games. It aids in the exploration of a language’s fundamental concepts as well as the development of the developer’s creativity.
Despite the fact that there are hundreds of languages in which to make games, developers choose to stick to a few programming languages. For a better experience, game makers frequently propose C Language.
Related Articles
Inquiries
If you have any questions or suggestions about Bouncing Ball in C with Source Code, please feel free to leave a comment below.
Frequently Asked Questions
How does this C or C++ project work?
Console application written in C (compiled with gcc) or C++ (compiled with g++). Uses standard library (stdio.h, conio.h, string.h, time.h) or C++ STL (iostream, vector, string, map). File-handling via fopen/fwrite or fstream for persistence. Foundation BSIT 1st-2nd year mini-project.
What compiler do I need to run this C or C++ project?
For C: gcc (GNU Compiler Collection) or MinGW (Windows). For C++: g++. IDE options: Code::Blocks (lightweight, built-in compiler), Dev-C++ (classic Philippine BSIT favorite), Visual Studio Code with C/C++ extension, CLion (paid). To compile from terminal: gcc program.c -o program (for C) or g++ program.cpp -o program (for C++), then run with ./program (Linux/macOS) or program.exe (Windows).
How do I run this C / C++ project?
Open the .c or .cpp file in your IDE (Code::Blocks, Dev-C++, VS Code). Click Build (or press F9), then Run (or press F5). From terminal: navigate to project folder, run gcc/g++ command above, then ./program. If using file storage, make sure the data file (e.g. records.txt) is in the same folder as the executable.
Can I use this C / C++ project for a BSIT capstone or thesis?
C/C++ projects are usually accepted for 1st-2nd year mini-projects or as building blocks. For a full capstone you would typically pair them with a more interactive frontend (e.g. wrap C++ logic with a Java/Python/PHP frontend, or extend to GTK/Qt for a real GUI). Standalone console C++ capstones are accepted by some panels but rare in 2026.
Why am I getting ‘undeclared identifier’ or ‘cannot find header’ errors?
Three common C/C++ issues: (1) Missing #include directive, e.g. #include
Where can I find more C or C++ projects with source code?
Browse the C and C++ Projects hub for the full library. For Java desktop alternatives see Java Projects. For higher-level languages see Python Projects. For BSIT capstone idea lists see 150 Best Capstone Project Ideas.





Source code password