Reading — step 1 of 5
Learn
Hello, World
C is fifty years old, runs everything beneath everything (your OS kernel, your language runtimes, your microwave), and has exactly one setting: manual. Learning C is learning what computers actually do — which is why this course exists, and why the languages you already know will make more sense after it.
#include <stdio.h>
int main(void) {
printf("Hello, World\n");
return 0;
}
Line by line, because each one carries real machinery:
#include <stdio.h>— a preprocessor directive: before compilation proper, the text of the standard I/O header is pasted here, declaringprintfso the compiler knows its shape. C has no automatic imports; you ask for every header you use.int main(void)— the entry point. It returns anintto the operating system:0means success, non-zero means failure. Shell scripts and CI pipelines genuinely read this value (echo $?) — it's not ceremony.printf("...\n")— print formatted text. Nothing is appended for you: no\nin your string, no newline in your output. Graders compare bytes; the missing-newline bug is the most common first-exercise failure on this platform.return 0;— report success. (Modern C returns 0 implicitly frommainif you omit it — write it anyway; explicit is the C way.)
The compile step is real
C doesn't run from source. You translate it to machine code first, and the translator is blunt about errors:
$ gcc -Wall -o hello hello.c
$ ./hello
Hello, World
-Wall turns on warnings, and you should treat it as mandatory. C's compiler, unlike Rust's, will happily compile many programs that are wrong — uninitialized variables, suspicious conversions, format-string mismatches. -Wall (and its friend -Wextra) upgrade the compiler from "translator" to "reviewer." A C programmer who ignores warnings is a C programmer with mysterious crashes; the platform's grader compiles your code for you, but read its compile output like it owes you money.
What C doesn't do for you
Setting expectations now saves confusion later. C has: no garbage collector (you free memory yourself — chapter 5), no bounds checking (read past an array and C hands you whatever bytes were there — chapter 2), no string type (strings are arrays with a convention — chapter 2), no exceptions (errors are return values you check). Every one of these is a deliberate trade for speed and control, every one is a way to shoot yourself in the foot, and — the real point of this course — every one teaches you what the "safe" languages are protecting you from and what that protection costs.
Your exercise
Print the exact text. printf, explicit \n, byte-exact match. Then break something on purpose — remove the semicolon, misspell printf — and read the error. C's diagnostics are terser than Rust's, and building tolerance for them early is a genuine skill: the error's line number is usually right even when its message is cryptic, and the actual mistake is on that line or the one above it.
Discussion
Ask a question, share an insight, or help someone who’s stuck.
Sign in to post a comment or reply.
Loading…