C Tutorial
C Projects
Ten complete C17 programs: a calculator, games, a grade book, and a tiny inventory.
What a project is on StudyGrid
A C lesson shows one idea: a loop, a struct, a pointer. A project uses several of them in oneint main(void) program. Each page here is a walkthrough with a complete program you can compile.
Click Try it in C under an example. That opens /c/try — gcc in the browser. Programs use hardcoded demo data so they run without extra stdin. After you understand the logic, wire in scanf if you want typed input.
10 build-along projects. Each page walks through the design, then a working program you can open inTry C at /c/try. Change a value, run it again, then try the practice tasks at the bottom.
The 10 projects
Calculator
A four-function calculator with a switch on the operator and a guard for divide-by-zero.
switch · double · printfBeginnerGuess the Number
Guess a secret integer. The program prints high, low, or correct and counts the attempts.
while · if · randBeginnerGrade Book
Store scores in an array, print each mark, then compute the average and the highest score.
arrays · for · averageBeginnerTemperature Converter
Convert Celsius to Fahrenheit and Kelvin with functions so the formulas stay in one place.
functions · double · mathBeginnerPalindrome Checker
Test whether a string reads the same forwards and backwards, ignoring case.
strings · strlen · ctypeIntermediateBank Account
A tiny account with deposit, withdraw, and balance. Withdrawals cannot go below zero.
struct · functions · doubleIntermediateTic-Tac-Toe
A 3x3 board in a 2D array. Place X and O, print the grid, and detect a winner or a draw.
2D array · loops · functionsIntermediatePhone Book
Store names and numbers in an array of structs, then search by name.
struct · strcmp · arraysIntermediatePrime Finder
List every prime up to a limit with trial division, then count how many you found.
for · bool · mathIntermediateInventory
Track item names, stock, and price. Print a table and the total value of the stock.
struct · arrays · printfHow to work a project
- Read the goal and the C skills listed on the page.
- Compile the first small example at
/c/try. - Build up to the complete program.
- Change one number or string and compile again.
- Finish the practice tasks before the next project.