C Part I · Module 1 · Understanding C and How Programs Work
What C Is and What It Is Not
Before writing a line of C it is worth being precise about what you are about to write, because two confusions here cost beginners months. The first is thinking the file you type is the program. It is not — it is text, and something has to turn it into a form your machine can run. The second is thinking C is a readable way of writing machine instructions. It is not that either: C is defined by a written standard that says what a program must do, and leaves an implementation free to achieve that however it likes. This chapter separates those ideas, distinguishes C from machine code, from assembly and from C++, and finishes by being honest about what C does not do for you. You will write no code here. You will finish knowing exactly what kind of thing you are about to write.
Foundation9 min readCPart IFundamentalsMental Model
Part I · Module 1 · Chapter 1.1 · What C Is and What It Is Not
1. C Is a Set of Rules for Writing Down What a Program Should Do
C is a programming language: an agreed set of rules for writing instructions that a computer can eventually carry out. Those rules cover which words mean what, where the punctuation goes, and what counts as a mistake.
You write C as ordinary text. A C file contains nothing exotic — you can open it in any text editor, read every character, and change it with a keyboard. That text is called source code, and a file of it conventionally ends in .c.
Here is a small piece of real C. You are not expected to understand the syntax yet — Chapter 1.4 takes a complete program apart line by line, and Module 5 covers what this particular shape is called. It is here so that you have seen what C looks like, and because what it says matters in a moment.
int add(int a, int b)
{
return a + b;
}In ordinary English, that says: given two whole numbers, the result is their sum. Hold on to that reading — §4 comes back to it.
Two things are worth noticing even now, because they hold throughout C. The braces and semicolons are what give the text its structure; the spacing and line breaks are there for human readers and do not change what the text means. And the words come from a small fixed vocabulary: int and return are part of the language, while add, a and b are names this author chose.
2. The File You Write Is Not the Program That Runs
This is the first distinction that matters, and it is the one most beginners never have stated to them plainly.
Your processor — the chip that actually carries out work inside the machine — cannot read .c files. It carries out a much simpler, far less readable set of operations, expressed as numbers. The text you wrote has to be translated into a form your machine can run before anything can happen. Until it is, your source code is a description of a program, not a program.
The program that performs that translation is called a compiler. You will use a real one in Chapter 1.5, and Chapter 1.6 opens up what happens inside that middle box.
One consequence follows immediately and is worth holding on to: changing your source file changes nothing until it is translated again. Editing text does not edit a program that already exists.
3. C Is Defined by a Document, Not by a Compiler
It is natural to assume C is "whatever the compiler on my machine accepts". It is not, and the difference is practical rather than academic.
C is defined by a written specification: a document that says what the language means. A compiler is a piece of software that implements that definition — which is why a compiler, together with the library and the environment it provides, is called an implementation of C. GCC is not C. Clang is not C. They are two implementations of the same specification, which is precisely why the same C source can be handed to either one.
This is also why C can be used on so many different kinds of machine. You write against the specification; each machine's implementation takes care of the rest.
Chapter 1.3 gets specific: which version of the standard this curriculum teaches, and the precise vocabulary for the cases where the standard deliberately lets implementations differ. For now, one sentence is enough: the language is the specification; your compiler is one implementation of it.
4. C Says What Must Happen, Not How
So a compiler turns your text into something the machine runs. That raises a question worth settling now, because the answer explains a great deal later: how closely does the translated program follow what you wrote?
Less closely than most beginners assume — and deliberately so. The standard does not say "this line must become these machine operations". It describes what a program must appear to do — what it reads, what it writes, what it displays, and in what order those visible things happen. An implementation is free to reach that outcome by any route it likes, as long as what you can observe is what the specification required.
That freedom is not a technicality. A real compiler routinely reorders work, computes things in a different sequence from the one you wrote, and removes work entirely when it can prove that what you observe is unchanged. All of that is allowed, because the requirement was on the observable result, not on the steps.
Look back at the preview in §1 with that in mind. It says given two numbers, the result is their sum — and that is all it says. It does not say which machine operations produce that sum, or in what order the two numbers are fetched. Those are the implementation's business, not yours.
5. What C Is Not
Two comparisons clear up most of the remaining confusion.
Not machine code, and not assembly
These are three different things at three different distances from the machine.
| What it is | Who writes it | Tied to a specific processor? | |
|---|---|---|---|
| C source | Text describing required behaviour | You | No — the same source can be translated for many machines |
| Assembly | Text naming individual machine operations | People, but rarely — it is usually produced by tools | Yes — written for one processor family |
| Machine code | The numeric operations a processor executes | Produced by tools, not people | Yes |
The row that matters is the last one. Your C file is not written for a particular processor; the implementation is what bridges that gap.
Not C++
C and C++ are two different languages. They share history and a great deal of surface syntax, which is exactly why they get conflated.
A C++ compiler is not a C compiler. Some C source is not valid C++ at all, and a smaller number of constructs are valid in both but mean different things. "C/C++" is a convenient shorthand in job adverts and a misleading one in engineering: when you are working in C, the C specification is what governs your program.
You need nothing more about C++ to learn C, and this curriculum never assumes it.
6. What C Gives You, and What It Asks in Return
C is a small language. Its vocabulary of reserved words — its keywords — is short enough to list on one page, and there is not much syntax to memorise. Most of what C can do comes from what you build out of those few pieces, plus a library of ready-made functions that comes with the implementation.
What makes C distinctive is not size, though, but how much of the representation of data you are expected to handle yourself. In many popular languages, questions like how much space does this value occupy, how long does this piece of data stay valid, and who is responsible for releasing it are answered for you by the language. In C, those questions are yours. That is why C remains the language of choice where the answers genuinely matter — and Chapter 1.2 looks at how that came about and where it still holds.
The cost is the other half of the bargain, and it should be stated plainly on the first page rather than discovered later:
C requires very little checking on your behalf. Many mistakes are not reported by the compiler, and are not detected while the program runs either. The program simply carries on and produces a result that may look entirely reasonable and be wrong.
This is not a flaw to be worked around; it is the direct consequence of §4. Once the language's obligation is only to produce the required observable behaviour for a program that followed the rules, a program that breaks the rules has no guaranteed behaviour left to fall back on. Chapter 1.3 gives you the precise vocabulary for this, and Module 13 is built entirely around it.
7. What You Should Be Able to Say Now
Check yourself against these five. If any is unclear, re-read this chapter before continuing — everything that follows assumes all of them.
- C is a programming language, and C source code is ordinary text that you write and can read.
- Source code is not the program. An implementation of C translates it into something the machine can run.
- C is defined by a written standard. A compiler such as GCC or Clang is one implementation of that standard, not the language itself.
- The standard describes the behaviour a program must produce, not the machine steps it must take — so the implementation may reach the required result by its own route.
- C checks very little for you, which is why understanding what a program means matters more here than remembering syntax.
8. Exercise
No code to write yet. These are reasoning questions and take a few minutes.
Exercise 1 — say which is meant. For each sentence, decide whether it is about C the language, a specific implementation, or a running program: (a) "C has no built-in text type." (b) "It stopped with an error on line 12." (c) "Clang accepted it but the other compiler didn't." (d) "The result came out as a negative number."
Exercise 2 — explain the consequence. A colleague edits a .c file, saves it, runs the program again, and reports that their change had no effect. Using only §2, give the most likely explanation in one sentence.
Exercise 3 — find what is wrong with the claim. Someone tells you: "C is just a nicer way to write assembly — each line becomes a few machine instructions." Name the idea from §4 they are missing, and describe one thing a compiler is permitted to do that their model cannot account for.
9. Summary
- C is a set of rules for describing what a program must do, written as ordinary text called source code.
- Source code is not the program. An implementation translates your text into something the machine can run, and nothing you type takes effect until it does.
- The language is the written standard, not any one compiler. GCC and Clang are implementations of it, which is why the same source can run on very different machines.
- The standard constrains observable behaviour, not machine steps. The implementation may reorder, restructure or discard work as long as what you can observe is unchanged — which is why "portable assembly" is the wrong model.
- C is not machine code, not assembly, and not C++.
- C hands you the questions other languages answer for you — how data is represented, how long it lasts, who releases it — and checks very little in return. That is why this curriculum teaches meaning rather than syntax.
The next chapter answers the question this one deliberately left open: given that trade-off, why was C built this way in the first place, and why is it still the right tool for so much engineering work today.
Standards & specifications
- Governing standard
- ISO/IEC 9899 (the C language standard)(opens ISO/IEC (JTC 1/SC 22/WG 14) in a new tab)
Defines the C language itself — the type system, expression semantics, object model, storage duration and the behaviour categories a conforming implementation must honour. It is a FAMILY of editions (C89/C90, C99, C11, C17, C23) and this curriculum names the edition wherever a claim depends on one. It does not define any foreign-function interface to a hardware description language, and it does not define platform behaviour: what a memory-mapped access does on real silicon is the implementation's and the device's contract, not this standard's. Working drafts published by WG14 are freely available and are what most engineers read day to day; a draft is not the published standard.
This page also covers RTL structure, verification approach and debugging technique. Those are engineering practice built on the standard, not requirements the standard itself imposes.
Where this fits
Part of the C Programming curriculum.
