basics · beginner · ~15 min

Hello, World!

Confirm your C toolchain works end-to-end: compile, link, run, exit 0.

Challenge

Your first C program

Every C journey starts here. The goal isn't the print — it's confirming that your toolchain works: the compiler is installed, the source compiles, the binary runs, and your terminal speaks UTF-8.

Task

Write a complete program that prints exactly:

Hello, World!

…followed by a single newline (\n).

Function signature

int main(void);

Output

A single line: Hello, World!. Nothing before, nothing after.

Rules

  • Use printf from <stdio.h> (not puts, not write — printf is the canonical first call).
  • Return 0 so the OS knows the program succeeded.
  • Don't print extra whitespace or extra newlines.

Examples

stdin stdout
(none — this program takes no input) Hello, World!\n

Edge cases

  • The trailing \n matters. The grader compares byte-for-byte.
  • No trailing space before the newline.

Why this matters

Hello-world is the smallest possible proof that your environment is real. Skip it and you'll spend an hour debugging an exercise when the actual problem was a missing #include.

Input format

No input.

Output format

Hello, World! followed by a newline.

Constraints

Use printf. Return 0.

Starter code

#include <stdio.h>

int main(void) {
    /* TODO: print Hello, World! */
    return 0;
}

Common mistakes

Missing #include <stdio.h> (compiler can't find printf). Forgetting the \n at the end. Using print (Python habit) or cout (C++ habit).

Edge cases to handle

Off-by-one whitespace. Mismatched newline. Trailing space before the \n.

Complexity

O(1) — just a single call to printf.

Background lessons

Up next

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.