basics · beginner · ~15 min

Hello, World!

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

Challenge

Print the exact line Hello, World! to standard output. This is the smallest possible C program, and its real job is to prove your toolchain compiles and runs a program end-to-end.

Task

Write a complete program (including main) that prints Hello, World! followed by a single newline, then exits successfully.

Input

None. The program reads nothing from standard input.

Output

The 13 characters Hello, World! followed by exactly one newline character, and nothing else. The output is graded byte-for-byte.

Example

The program takes no input. Expected output (exact bytes):

Hello, World!

That is the text Hello, World! terminated by a single newline.

Edge cases

  • The trailing newline is required — printing the text without the final newline fails the byte-for-byte check.
  • Do not print any extra spaces, extra blank lines, or other text.

Rules

  • Use printf from <stdio.h>.
  • Return 0 from main to signal success.

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

None — the program reads nothing from standard input.

Output format

The line Hello, World! terminated by a single newline, and nothing else.

Constraints

Use printf from <stdio.h>; return 0. Output is graded byte-for-byte.

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.