Quiz Entry - updated: 2026.07.14
What are the main C Standard Library headers and their purposes?
The C standard library is split across topic-specific headers — <stdio.h> for I/O, <stdlib.h> for utilities/memory, <string.h> for strings, <math.h> for math, and so on.
| Header | Purpose | Key Functions |
|---|---|---|
<stdio.h> |
Input/output | printf, scanf, fopen, fread |
<stdlib.h> |
General utilities | malloc, free, exit, atoi, rand |
<string.h> |
String handling | strlen, strcpy, strcmp, memcpy |
<math.h> |
Mathematics | sin, cos, sqrt, pow, log |
<ctype.h> |
Character handling | isalpha, isdigit, toupper |
<time.h> |
Date and time | time, clock, strftime |
<stdint.h> |
Fixed-width integers | int32_t, uint8_t, SIZE_MAX |
<stdbool.h> |
Boolean type (C99) | bool, true, false |
<assert.h> |
Diagnostics | assert |
<errno.h> |
Error codes | errno, ENOENT, ENOMEM |
Where the library lives:
Headers: /usr/include/*.h
Code: /usr/lib64/libc.a (static) or libc.so (dynamic)
Learning about functions:
# Section 3 = library functions
$ man 3 printf
# Section 2 = system calls
$ man 2 open
# Learn about man sections
$ man man
Important distinction:
- Library functions (section 3):
printf,malloc,strlen - System calls (section 2):
open,read,write,fork
System calls are the actual kernel interface; library functions often wrap them.
Tip: Full reference at https://en.cppreference.com/w/c/header