Skip to content
Learn at your own pace

Learn C

Learn C from compilation and memory to data structures, files, concurrency and secure, tested command-line tools.

A student connects colorful building blocks beside a laptop, illustrating a sequence of programming instructions.
One small step becomes a working program.
24lessons in 6 stages
48practice exercises
24project milestones
96quiz questions
96review cards

A clear place to start

C lets you work close to a computer’s memory and operating system. You compile the program and explicitly manage many details that other languages hide.

What you need first

Be comfortable with variables, loops, and functions in a small program. Learn these first in Python or JavaScript if programming itself is new. Install a C compiler before beginning.

Start with these ideas

  1. A declaration gives a value a type, such as int count = 0. A function prototype describes its inputs and result.
  2. An array has a fixed storage capacity. A C string uses a null character to mark the end of its text.
  3. A pointer refers to a memory location. Always ask whether the location is valid, who owns it, and how long it remains alive.

Connect it to a real project

Build a word counter, adding safe input handling, clear error codes, multiple source files, and memory checks as you progress.

Study one concept at a time. Explain its everyday example in your own words, predict the worked example’s result, then try a small change. Use practice and quiz feedback to decide what to revisit. You can spread a lesson across several study sessions.

Set up your environment Tools, setup steps, and completion requirements

Start with the ideas above, then set up the tools below. Return to the starter example whenever a new term feels unfamiliar.

text
cc --version
cc -std=c17 -Wall -Wextra -Werror -pedantic -g -o lesson lesson.c
./lesson
# Debug builds: add -fsanitize=address,undefined to catch memory errors early.
# Windows: use WSL or MSYS2 with gcc, or cl /W4 in a Developer Command Prompt.

A free account saves your progress, notes, exercise evidence and spaced review cards. To complete a lesson, score at least 80% on its quiz, finish both exercises and the project checklist, and submit your project link with a reflection. Project evidence is self-reported; use the final portfolio rubrics to seek an independent code review.

Your C learning path

Work through these foundations in order, then bring them together in a project.

24 of 24 lessons · follow the stages in order

Start with a small example

Save this as lesson.c, compile it with cc -std=c17 -Wall -Wextra -o lesson lesson.c and run ./lesson. The loop prints a learning goal for each topic.

#include <stdio.h>

int main(void)
{
    const char *topics[] = {"pointers", "memory", "testing"};

    for (int i = 0; i < 3; i++) {
        printf("Learn %s\n", topics[i]);
    }
    return 0;
}

Try it yourself

Compute the array length with sizeof instead of the literal 3, then move the loop into a function that receives the array and its length.

Put it into practice

Build a word counter

Write a small command-line tool that counts the words in a file.

  1. Read a file named on the command line and report open errors clearly.
  2. Count words and lines in a loop over characters.
  3. Return documented exit codes for missing arguments and unreadable files.
  4. Test it under AddressSanitizer with empty, large and malformed files.
Keep exploring

Find your next course

Choose a language, build on it with a framework, or explore AI and search.

Showing 6 of 17 courses