Hello, and welcome back.
Starting a new section here, I wanted to give you some information
on the c standard library.
We've been using a lot of the functions in c standard library.
And the c standard library is basically all the functionality that
comes with the c programming language.
So it's code that you can reuse that you don't need to write on your
own, and we've looked at some of the functions that are available,
such as string manipulation functions, reading and writing files,
reading input from the keyboard.
There's a lot of files that we've used, and it's very
advantageous to use these files.
Now I wanted to tell you about some of the standard header files.
We've discussed some of these, but I want to make sure that you at
least get a brief understanding of these important header files.
So stddef.h.
This contains some of the standard definitions.
These are some of the files that we haven't actually discussed
yet that I wanted to mention.
So stddef.h has functions like null or actually has
some constants and functions.
It has a null for null pointer constant.
It also has a offset of function which takes a structure and a member.
This is the offset in bytes of the member from inside the
structure, and it returns a size t.
There's a function or type I should say called pointer diff t.
This is the type of integer produced by subtracting two pointers.
Size underscore t.
We view size underscore t in a couple of routines.
This is what's returned from the sizeof operator.
And then wchart, this is an integer required to hold wide characters.
This is just some of the basic stuff that's in stddef.h, mainly
constants that you can use.
Really the important one here is null and size t which you use quite a bit.
We also have our limits.h header file.
Limits.h has a lot of important constants as well.
It contains various implementation defined limits for character
and integer data types.
So you can go through this list.
There's so many of them.
Again, I just wanted you to be aware of them.
You don't have to memorize these.
Sometimes you may need to use them depending if you're
running on different platforms.
But there's things like integer max values, long minimum values,
long max, it's a good way to check for the range of the different
characters that are defined.
Again, useful for using on when you're running on different systems.
And we didn't really get to look at limits.h as much as I wanted
to as well as the stddef.h.
Stdbool.h, we looked at real quickly.
Remember that we have a Boolean data type in c,
but it's underscore bool.
And it's kind of difficult to use that one because whenever you use it,
you have to say underscore bool and it returns zero or
ones representing true or false.
Well, if you include stdbool.h, you can declare your variables
just with bool, because there's a typedef in there.
We haven't talked about it, but it's an easier way and it's more
convention to just see bool.
Whenever you say bool, it will refer to the underscore boolean data type.
And then you can use constants for turn false
which will return one or zero.
It makes your program more readable to you stdbool.h, and you should
try to use it because you can immediately compare some of your
variables that are of type bool to true or false, and it's easier than
c compared to one or zero because then you might think it's an int.
So definitely use stdbool as well.
The other header files that we're going to discuss in
the standard library are ones that we actually used.
These were the three that I wanted to emphasize that we didn't really
get to use as much as I liked.
And I wanted you to be aware of them.
So make sure you study stdbool.h, make sure you understand
stddef.h and the limits.h file.
Thank you.