Loading
0x00Lesson 1 of 20

What is C, and why learn it?

Where C came from, where it runs today, and how a C program goes from text to something your computer can execute.

8 min 5-question quiz
By the end of this lesson you can
  • Explain what C is and name places it is used today
  • Describe the compile step: source code in, executable out
  • Tell the difference between a compiled and an interpreted language

C is a small, fast, general-purpose programming language. It gives you a thin, predictable layer over what the hardware actually does: memory is a long row of numbered bytes, and your program reads and writes them. That closeness to the machine is exactly why C is still everywhere, fifty years after it was created.

Where C came from

C has been standardized several times since. You will see these names: C89/C90 (the first standard), C99 (added // comments, bool, declaring variables anywhere), C11, C17 (bug fixes), and C23 (the newest). This track uses modern C17, which every current compiler supports.

Where C runs today

You use software written in C every day, usually without noticing:

  • Operating systems: the Linux kernel, most of Windows' and macOS's low-level parts.
  • Embedded devices: microwaves, cars, routers, pacemakers, anything with a microcontroller.
  • Language runtimes: the main Python interpreter (CPython), Ruby, PHP and Lua are written in C.
  • Databases and servers: SQLite, PostgreSQL, Redis, nginx.
  • Games and graphics: engines and drivers where every millisecond counts.

For concrete examples, the Linux kernel documentation shows C used for operating-system work, while SQLite explains why its database engine is coded in C. The code in this track is a small, portable subset of the language; production projects add platform APIs and extensive testing.

From source code to a running program

C is a compiled language. You write source code in a plain text file ending in .c. A program called a compiler (such as gcc or clang) reads it and translates it into machine code - the raw instructions your processor runs - and saves that as an executable file.

Under the hood the compiler works in stages:

  1. Preprocessing: handles lines starting with #, like #include <stdio.h>, by pasting in other files.
  2. Compiling: turns your C into assembly, then into machine code (an object file).
  3. Linking: joins your object file with library code (like the code behind printf) into one executable.

On Linux or macOS, compiling and running a program looks like this in a terminal:

terminal
$ gcc -Wall -o hello hello.c
$ ./hello
Hello, world!

Try it

Up to 15 XP

Where in the build?

Sort each action into the stage where it belongs. Predict the order from source file to running program.

0 of 4 sortedScore 0/0
  • “Expand #include <stdio.h>”

  • “Translate C into object code”

  • “Join your code with library definitions”

  • “Execute main()”

gcc is the compiler, -Wall turns on helpful warnings, -o hello names the output file, and hello.c is your source. Then ./hello runs the program you just built. In this track you do not need to install anything: code examples and exercises compile and run right here on the page.

What makes C different

C is famous for trusting the programmer. That has good and bad sides:

C gives youC expects from you
Direct access to memory through pointersNever reading or writing memory you do not own
Very fast, very small programsManaging memory yourself (no garbage collector)
Portability to almost any hardwareChecking errors - C will not stop you

This track will teach you both halves: the power, and the habits that keep that power safe.

Key takeaways

  • C was created at Bell Labs in the early 1970s to write Unix, and is still used for operating systems, embedded devices, databases and language runtimes.

  • C is compiled: a compiler such as gcc turns .c source into a machine-code executable in stages - preprocess, compile, link.

  • C gives you direct control over memory and expects you to use it carefully.

Lesson quiz

5 questions · pass with 4 correct · up to 50 XP

Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.

Questions about this lesson

Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.

Loading posts…