It's Bad Enough I Have To Write Code, Now I Have To Read At C Libraries?
No, but I love the visual! Libraries are utilities we can use to in our programs to save us a lot of time from writing functions we often use. For instance, programming would not be nearly as fun if we needed to keep writing the same printf() function to be included in every file. Rather, we can use #include <stdio.h> which packages printf() along with many other useful functions in one line!
There are a variety of libraries that are considered to be standard in the C language. We’ll go over the most popular libraries used in C. When using libraries that are not quite as popular, like <math.h> we will have to link the library into our program -which we’ll go over in more detail. Finally, we’ll also cover how you can write your own libraries to make developing in C much easier later down the road!
Before we begin, it is important to note some security concerns with external libraries you may find online. While none of the libraries we will be interacting with require downloading from the internet, keep in mind where you download your libraries. Now that you know how to program in the C programming language, be sure to look the code over if you are unsure of the authenticity of the downloaded source code.
Now, let the firehose begin!
Reading Is Cool! How Do I Make My Own C Libraries?
See, C libraries aren’t so bad! Let’s wrap up this section with another video:
We have covered all of the basic libraries C has to offer. There are several other libraries, as well as “custom libraries” that do not ship with C by default, but are commonly used. <curses.h> is an interesting package that works with legacy C installations and it adds more graphic capabilities!
Before we close out this post, let’s create a random number generator. This implementation is not a truly random generator so do not use this for any cryptographic application.
Now that you know how to make a library, can you implement a random number function and store it in a library? This exercise will be a nice warm up to our upcoming project!
Founder and CEO of R U Coding Me LLC. Jacob obtained his Bachelor’s of Computer Science at the University of Central Florida. He likes to go to the gym and teach people about technology.