Welcome! I'm HTMLOnline, your C learning companion.
We explain new ideas in plain language, practise repeatedly and build useful projects. No previous coding course is required.
Clear learning order Practise every chapter Projects and exams
C STARTER EXAMPLEprintf("Hello, learner!\n");Your first useful result is only a few careful steps away.
Checking progress…
EXPLORE BEFORE YOU START
Learn C Programming from Zero: course outline
A patient, practical C course for complete beginners, with plain-language lessons, repeated code practice, section exams and useful projects.
10 sections · 80 chapters · 20 project chapters
Before you begin
No previous programming course is required. Begin with the first section and learn the vocabulary before moving to larger programs.
You can read this outline without signing in or completing onboarding. Start with the welcome screen above when you are ready to practise. Use a current browser; a keyboard and larger screen can make longer coding tasks easier, but the lesson interface also adapts to phones.
Practice and assessment
The in-page coding checks look for required patterns; they do not compile or execute C/C++. Use a suitable compiler to verify syntax, input, output and memory behavior. Each section combines explanations, practice, projects and a ten-question exam.
Read an explanation, study the example, try the task and review feedback. Keep your own project files and test them in their intended environment. Completing an activity or a course certificate is not an accredited qualification or a guarantee of employment.
What each section covers
Expand a section to read its chapters and projects. This is the actual course curriculum, not a separate list of promised future topics.
01Meet programming and C8 chapters
Begin before variables: learn what a program is, what C does, how source code becomes a running program and how to read the first lines.
Section outcome: Explain and write a small C program that prints several clear messages.
What a computer program is
Discover how precise instructions become a useful program and where the C language fits.
Source code, compiler and executable
Follow a C program from the file you write to the program the computer can run.
Practice lab: Source code, compiler and executable
Rebuild and vary the source code, compiler and executable example until every important piece feels familiar.
Anatomy of main, include and statements
Read a complete tiny C program without treating any symbol as magic.
Errors, warnings and useful comments
Learn to read mistakes calmly and write comments that explain decisions.
Practice lab: Errors, warnings and useful comments
Rebuild and vary the errors, warnings and useful comments example until every important piece feels familiar.
Mini project: Console identity cardProject
Combine several output statements into a neat introduction.
Unit project: Community event noticeProject
Design a complete text notice and turn it into a tidy C program.
02Values, input and operators8 chapters
Store information, choose suitable data types, accept keyboard input and calculate dependable results.
Section outcome: Build small interactive calculators and explain every value and conversion.
Variables, names and assignment
A variable gives a typed piece of memory a useful name so a program can store and update a value.
Integers, decimals, characters and format specifiers
C data types tell the compiler what kind of value is stored and which operations and output formats are appropriate.
Practice lab: Integers, decimals, characters and format specifiers
Rebuild and vary the integers, decimals, characters and format specifiers example until every important piece feels familiar.
Keyboard input with scanf and validation
Input makes a program interactive, but the return value from scanf must be checked before the destination value is trusted.
Arithmetic, precedence and type conversion
Operators combine values, precedence controls evaluation order, and conversions determine whether a result keeps or loses a fractional part.
Practice lab: Arithmetic, precedence and type conversion
Rebuild and vary the arithmetic, precedence and type conversion example until every important piece feels familiar.
Mini project: Market purchase totalProject
Read a quantity and unit price, then show a clearly labelled total.
Unit project: Household budget summaryProject
Combine several expenses and income to show a useful remaining balance.
03Decisions and logic8 chapters
Make programs choose safely with comparisons, logical operators, if chains and switch.
Section outcome: Translate real rules into readable, testable branches.
Comparisons and logical operators
Comparison expressions produce true or false results, while &&, || and ! combine or reverse conditions.
if, else and clear branches
An if statement runs a block when its condition is true; else provides one alternative when it is false.
Practice lab: if, else and clear branches
Rebuild and vary the if, else and clear branches example until every important piece feels familiar.
else-if chains and nested decisions
An else-if chain checks ordered alternatives, while nesting handles a second decision that matters only inside a first branch.
switch choices and the conditional operator
switch expresses equality choices for one integral value; the ?: operator selects one of two values in a compact expression.
Practice lab: switch choices and the conditional operator
Rebuild and vary the switch choices and the conditional operator example until every important piece feels familiar.
Mini project: Age-group classifierProject
Classify an entered age with explicit, non-overlapping boundaries.
Unit project: Clinic triage guideProject
Combine urgent symptoms and measurements into a careful priority message.
04Loops and repetition8 chapters
Repeat work with while, for and do-while loops while preventing runaway or off-by-one behaviour.
Section outcome: Choose a suitable loop, trace every iteration and build repeated reports.
while loops and changing state
A while loop repeats as long as its condition remains true, so its body must normally change something that moves toward stopping.
for loops and counted repetition
A for loop places initialisation, condition and update together, making it especially clear for counted repetition.
Practice lab: for loops and counted repetition
Rebuild and vary the for loops and counted repetition example until every important piece feels familiar.
do-while and input menus
A do-while loop runs its body once before checking the continuation condition, which suits menus that must appear at least once.
Nested loops, break and continue
Nested loops handle grids or combinations; break exits the nearest loop and continue skips to its next iteration.
Practice lab: Nested loops, break and continue
Rebuild and vary the nested loops, break and continue example until every important piece feels familiar.
Mini project: Multiplication tableProject
Generate a labelled multiplication table for one chosen number.
Unit project: Savings progress trackerProject
Accumulate regular deposits and report the balance after every period.
05Functions and program structure8 chapters
Break programs into named jobs with parameters, returns, scope and careful recursion.
Section outcome: Design, call and test small reusable functions across source files.
Function declarations, definitions and calls
A function packages a named job; a declaration describes its interface, a definition supplies its body and a call asks it to run.
Parameters, arguments and return values
Parameters receive values from a caller, and a return value sends one result back to the calling expression.
Practice lab: Parameters, arguments and return values
Rebuild and vary the parameters, arguments and return values example until every important piece feels familiar.
Local scope, lifetime and global state
Scope controls where a name is visible; lifetime controls how long its object exists. Local variables make dependencies easier to see.
Recursion and your own header files
A recursive function solves a smaller version of its problem and needs a base case; header files share declarations between source files.
Practice lab: Recursion and your own header files
Rebuild and vary the recursion and your own header files example until every important piece feels familiar.
Mini project: Reusable unit converterProject
Create small functions for kilometres-to-miles and Celsius-to-Fahrenheit conversions.
Unit project: Modular calculatorProject
Organise arithmetic operations as separate functions behind a readable menu.
06Arrays and strings8 chapters
Store collections, traverse them within bounds, model tables and handle text as character arrays.
Section outcome: Process marks, grids and user text without crossing array boundaries.
One-dimensional arrays and indexing
An array stores a fixed number of same-type elements in contiguous memory, addressed by zero-based indexes.
Traversing arrays and respecting bounds
A loop can visit every element when its condition is derived from the array length rather than a guessed number.
Practice lab: Traversing arrays and respecting bounds
Rebuild and vary the traversing arrays and respecting bounds example until every important piece feels familiar.
Two-dimensional arrays and tables
A two-dimensional array models rows and columns; nested loops select each cell with two indexes.
Character arrays and safe text input
A C string is a char array ending with a null character; fgets can read a bounded line including spaces.
Practice lab: Character arrays and safe text input
Rebuild and vary the character arrays and safe text input example until every important piece feels familiar.
Mini project: Marks analyserProject
Calculate the total, average, highest and lowest values in a marks array.
Unit project: Attendance registerProject
Store learner names and daily presence values, then generate a concise attendance report.
07Pointers and memory8 chapters
Work with addresses, dereferencing, pointer parameters, array relationships and null safety.
Section outcome: Use pointers deliberately and explain which object every pointer may access.
Addresses, pointers and dereferencing
A pointer stores the address of an object; dereferencing follows that address to read or update the object.
Pointer parameters and output values
Passing an address lets a function update a caller-owned object while making that effect visible in its parameter type.
Practice lab: Pointer parameters and output values
Rebuild and vary the pointer parameters and output values example until every important piece feels familiar.
Arrays, pointers and pointer arithmetic
In many expressions an array name becomes a pointer to its first element, and adding one advances by one element of the pointed-to type.
const pointers, NULL and ownership questions
const communicates read-only access, NULL represents no object, and every pointer should have a clear owner and valid lifetime.
Practice lab: const pointers, NULL and ownership questions
Rebuild and vary the const pointers, null and ownership questions example until every important piece feels familiar.
Mini project: Swap and order valuesProject
Use pointer parameters to swap two integers and place them in ascending order.
Unit project: Inventory updaterProject
Update selected inventory records through pointers while preventing null and out-of-range access.
08Structs, enums and unions8 chapters
Model meaningful records and named states with structures, typedef, enumerations and carefully chosen unions.
Section outcome: Represent real records with readable types and process collections of them.
Structure types and member access
A struct groups values of different types into one record whose named members describe their roles.
Arrays and nested structures
Arrays of structs store many records of one shape, while nested structs reuse a smaller record inside a larger one.
Practice lab: Arrays and nested structures
Rebuild and vary the arrays and nested structures example until every important piece feels familiar.
typedef and enumerated states
typedef provides a convenient type name, while enum gives meaningful names to a controlled set of integral states.
Unions and tagged alternatives
Union members share storage, so a separate tag is normally needed to record which member currently holds a valid value.
Practice lab: Unions and tagged alternatives
Rebuild and vary the unions and tagged alternatives example until every important piece feels familiar.
Mini project: Patient recordProject
Model one patient with identity, age and a named triage state.
Unit project: Student records reportProject
Store several students, calculate individual averages and locate the strongest result.
09Files and dynamic memory8 chapters
Persist text safely and request variable-sized memory with explicit ownership and cleanup.
Section outcome: Read, write and grow data while handling every file or allocation failure.
Opening files, modes and errors
fopen returns a FILE pointer for a requested mode or NULL when the file cannot be opened.
Reading and writing text files
fgets reads bounded lines, fprintf writes formatted text and every operation should be checked when data matters.
Practice lab: Reading and writing text files
Rebuild and vary the reading and writing text files example until every important piece feels familiar.
malloc, calloc, realloc and free
Dynamic allocation obtains memory at runtime; allocation may fail and every owned allocation must eventually be freed.
Growing arrays and explicit ownership
realloc can resize an allocation but may move it, so preserve the original pointer until success is known.
Practice lab: Growing arrays and explicit ownership
Rebuild and vary the growing arrays and explicit ownership example until every important piece feels familiar.
Mini project: Persistent notes fileProject
Append dated notes and list them again with robust file checks.
Unit project: Dynamic expense ledgerProject
Grow an expense collection at runtime, calculate totals and save a report.
10Algorithms, modular C and capstone8 chapters
Search, sort, split programs into files, test boundaries and reason about efficiency.
Section outcome: Plan and deliver a maintainable multi-feature C capstone.
Linear and binary search
Linear search checks items in order; binary search repeatedly halves a sorted search range.
Sorting and comparing algorithms
Sorting rearranges records by a key; simple algorithms make correctness visible before more efficient library or advanced methods.
Practice lab: Sorting and comparing algorithms
Rebuild and vary the sorting and comparing algorithms example until every important piece feels familiar.
Headers, source files and separate compilation
A modular C program exposes interfaces in headers, keeps definitions in source files and links compiled units together.
Defensive programming, tests and complexity
Defensive code validates assumptions, tests target normal and edge cases, and complexity describes how work grows with input size.
Practice lab: Defensive programming, tests and complexity
Rebuild and vary the defensive programming, tests and complexity example until every important piece feels familiar.
Mini project: Searchable item catalogueProject
Search structured records by identifier and report a clear not-found result.
Capstone: Community records managerProject
Combine records, menus, validation, search, files and dynamic storage into a maintainable console application.
Progress, accounts and certificates
Guest progress is saved in this browser on this device. Clearing site data or switching browsers can remove access to that local progress. An optional account can synchronize supported course progress; it is not required to access the lessons. Download or back up project work separately.
Certificates recognize completion of the course activities on this site. They are not university credit, professional accreditation or proof that every program you write is correct.