Chapter 13: C Libraries and Header Files
Learn how to use libraries and header files in C.
Chapter 13: C Libraries and Header Files
Table of Contents
- Table of Contents
- 13.1 Standard Libraries
- 13.2 Creating and Using Header Files
- 13.3 Exercises
- 13.4 Solutions
- 13.5 What’s Coming in the Next Chapter
13.1 Standard Libraries
C provides many libraries, e.g., <stdio.h>
, <stdlib.h>
, <string.h>
.
13.2 Creating and Using Header Files
Header files allow you to declare functions and share code between files.
13.3 Exercises
- List three standard C library headers.
- Write a header file declaring a function
int add(int, int);
. - How do you include a header file in your program?
13.4 Solutions
13.4.1 Solution 1
<stdio.h>
, <stdlib.h>
, <string.h>
13.4.2 Solution 2
1
2
// mymath.h
int add(int, int);
13.4.3 Solution 3
Use #include "mymath.h"
13.5 What’s Coming in the Next Chapter
Next, you’ll learn about debugging and best practices in C!
This post is licensed under CC BY 4.0 by the author.