Zum Inhalt springen
KodeTrail

Camp 1 · Schritt 2 von 12

Hello, World!

The original Hello World — from the book that taught the world to program — line by line.

12 Min.+50 XPAuf Englisch angezeigt — Übersetzung ist unterwegs

The phrase "Hello, World!" as a first program comes from The C Programming Language (1978). You're about to run the ancestor of every Hello World ever written.

The program

CCloud-Run

Every piece decoded

#include <stdio.h> A preprocessor directive that pulls in the standard input/output library — which provides printf. Without it, C wouldn't know how to print. The #include lines always sit at the top.

int main(void) Every C program's entry point. int means it returns an integer; (void) means it takes no arguments.

printf("Hello, World!\n"); Prints text. The \n is a newline — C won't add one for you (unlike Python's print). Leave it out and the next output crowds onto the same line.

return 0; Hands 0 back to the operating system, meaning "success". Non-zero signals an error. This is a convention the whole OS relies on.

The details C insists on

  • Every statement ends with ;
  • Text needs the \n for line breaks — spell them out
  • main returning int and ending with return 0; is the standard shape
Checkpoint

What does the newline escape do in printf("Hi\n"); ?

Checkpoint

Why is #include <stdio.h> needed?

What's next

The compile step in detail — what actually turns your .c file into a running program.