C quick reference
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
mainfunction,#include <stdio.h>andprintf. -
Variables and types
Integer and floating types,
printfformat specifiers,sizeof, casts, and integer division. -
Conditions and loops
if/else,switch,for,whileanddo … 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, andstruct. -
Strings
Strings as
chararrays ending in\0,<string.h>,snprintf, and POSIX regular expressions. -
Dynamic memory
Allocate with
malloc/calloc, grow withrealloc, and release withfree.
Input and files
-
Reading input (stdin)
Read what you type in the IDE's Input tab with
scanforfgets. -
Reading and writing files
Open project files with
fopen; write temporary files under/tmp. -
Header files and several sources
Put declarations in a
.hfile and definitions in a.cfile; the IDE links them into your program.
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.