Appendix B: Standard Library Cheatsheet
Quick reference for common C standard library functions.
Appendix B: Standard Library Cheatsheet
Table of Contents
- Table of Contents
- B.1 Input/Output
- B.2 String Handling
- B.3 Memory Management
- B.4 Math Functions
- B.5 Exercises
- B.6 Solutions
B.1 Input/Output
printf,scanffrom<stdio.h>fopen,fclose,fgets,fputs
B.2 String Handling
strcpy,strncpy,strlen,strcmp,strcatfrom<string.h>
B.3 Memory Management
malloc,calloc,realloc,freefrom<stdlib.h>
B.4 Math Functions
abs,sqrt,pow,sin,cosfrom<math.h>
B.5 Exercises
- Which function copies one string to another?
- How do you allocate memory for 10 integers?
- Which header provides file I/O functions?
B.6 Solutions
B.6.1 Solution 1
strcpy or strncpy.
B.6.2 Solution 2
malloc(10 * sizeof(int));
B.6.3 Solution 3
<stdio.h>
This post is licensed under CC BY 4.0 by the author.