Skip to content
Guest
← All References
C ISO C11 / C17 (GCC, Clang)

C Programming Quick Reference

Essential C11 syntax, printf format specifiers, pointers, structs, and dynamic heap allocation.

int *p = malloc(n * sizeof(int)); free(p);

Types & printf Specifiers

TypeSpecifierExample
int%dprintf("%d", count);
size_t%zuprintf("%zu", sizeof(arr));
double%.2fprintf("%.2f", price);
const char *%sprintf("%s", name);
void *%pprintf("%p", (void *)ptr);

Pointers, Structs & Heap

PatternPurposeExample
&x / *pTake address / dereference pointerint *p = &x; *p = 10;
typedef structDefine custom composite typetypedef struct { int x, y; } Point;
ptr->fieldAccess field through struct pointeruser->score += 5;
malloc / freeAllocate and release heap memoryint *a = malloc(16); free(a);
sizeof(a)/sizeof(a[0])Local fixed array lengthsize_t n = sizeof(a) / sizeof(a[0]);

Search courses, lessons, and references

Type to search across all courses, lessons, and quick references.

Press Esc to close Powered by Pagefind