C quick reference

Runs in Zerethon IDE · C (GCC 14) Official C documentation ↗

C (GNU C17, GCC 14) essentials: printf and types, control flow, functions, arrays and pointers, strings, structs and memory, input and files, several source files — and how gcc builds and runs your project in Zerethon IDE.

Written for C (GCC 14). Examples that show an output were run in the Zerethon sandbox (C (GCC 14)) on 2026-10-20.

Basics

  • Hello, World

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

  • Variables and types

    Integer and floating types, printf format specifiers, sizeof, casts, and integer division.

  • Conditions and loops

    if / else, switch, for, while and do … while.

  • Functions

    Declaring and defining functions, passing by value, and returning results through pointers.

Data

  • Arrays, pointers and sorting

    Arrays and their length, pointers, sorting with qsort, and struct.

  • Strings

    Strings as char arrays ending in \0, <string.h>, snprintf, and POSIX regular expressions.

  • Dynamic memory

    Allocate with malloc / calloc, grow with realloc, and release with free.

Input and files

In Zerethon IDE

  • Running C in Zerethon IDE

    How Run compiles your project with gcc, the flags it uses, the time limit, input and tests.

  • Common errors

    Compiler errors (“undeclared”, “implicit declaration”, “undefined reference”), warnings, and crashes such as a segmentation fault.

  • Official documentation

    Where to read more: the C reference on cppreference.com and the GCC 14 manual.

References