stdlib, math, ctype & time in C

From the C cheat sheet · Standard Library · verified Jul 2026

stdlib, math, ctype & time

Common utility functions.

c
// Quick Reference
#include <stdlib.h>  // atoi, qsort, rand, exit
#include <math.h>    // sqrt, pow, floor
#include <ctype.h>   // isdigit, toupper
#include <time.h>    // time, clock
💡 <stdlib.h> holds conversions (atoi/strtol), qsort/bsearch, rand, malloc, and exit.
⚡ Some systems need -lm to link <math.h> functions (gcc main.c -lm).
📌 <ctype.h> (isdigit, toupper) classifies/converts single characters portably.
🟢 qsort/bsearch are generic via void* - the same function-pointer pattern as callbacks.
stdlibmathlibrary
Back to the full C cheat sheet