About this chapter

Location
  1. Courses

    /

  2. Complete C++ Course

    /

  3. The C Standard Library

    /

  4. About this chapter

The purpose of this chapter

The purpose of this chapter is to present the main functions of the C Standard Library. They will not all be shown here, because there is a very great amount of them and they are not all frequently used. After reading this chapter, you should have learned enough about the C language to follow more advanced C tutorials and start coding graphical applications (Programs that use windows and display graphics inside them). You can then consider yourself an accomplished C programmer (A beginner one, however).

After this chapter

When you finished this chapter, I recommend you to either follow a tutorial about the SDL library (A multi-platform and widely used C library that provides tools to manage windows and display graphics) and then read the next chapters to continue learning about the C++ language, or to directly continue to the next chapter.

The standard libraries

There are many functions defined in the C/C++ Standard Libraries for which we could code, ourselves, functions with the same behavior, without having to use any library. Then, why using them? There are two reasons. First, the functions from the standard libraries are usually extremely optimized and are often written using assembly code. The odds we code better (performance-wise) functions are low. Secondly, rewriting them takes time (Especially if we try to code better-performing functions). It is also good to note that the functions of the standard libraries are (supposed to be) bug free. Taking time to make sure it is the case for our functions too takes a great amount of time.

It does, however, not mean that it is always better to not code functions that does the same thing as functions defined in the standard library. We could do so to make sure that the implementation of the function is the same, no matter what compiler is used. Also, if a function is heavily used, it is not a bad idea to try to code a better-performing implementation of it.