Hello, World

A main function, #include <stdio.h> and printf.

Runs in Zerethon IDE · C (GCC 14) Official C documentation ↗
main.c
#include <stdio.h>

int main(void) {
    printf("Hello, World!\n");
    printf("Sum: %d\n", 2 + 3);
    puts("puts adds the newline itself");
    return 0;
}

Output

Hello, World!
Sum: 5
puts adds the newline itself
  • printf does not add a newline: end the text with \n.
  • return 0; from main means success; any other value is shown as the exit code.
  • Each #include brings in the declarations of a standard header (<stdio.h> for input/output, <string.h>, <stdlib.h>, <math.h>, …).

Related topics

Official references