C quick reference
Common library functions on one page.
| Function | Purpose |
|---|---|
printf / scanf | Formatted output and input |
fgets(buf, n, stdin) | Read a line safely |
strlen(s) | String length |
strcpy / strncpy | Copy a string |
strcmp(a, b) | Compare strings; 0 means equal |
malloc / free | Get and release heap memory |
fopen / fclose | Open and close a file |
abs / rand | Absolute value / random number |