C – Standard Library
Last updated on 19/03/2020The C standard library or libc is the standard library for the C programming language, as specified in the ANSI C standard. It was developed at the same time as the C library POSIX specification, which is a superset of it. Since ANSI C was adopted by the International Organization for Standardization, the C standard library is also called the ISO C library.
The C standard library provides macros, type definitions and functions for tasks such as string handling, mathematical computations, input/output processing, memory management, and several other operating system services.
Implementations of C-Standard Library
Unix-like systems typically have a C library in shared library form, but the header files (and compiler toolchain) may be absent from an installation so C development may not be possible. The C library is considered part of the operating system on Unix-like systems. The C functions, including the ISO C standard ones, are widely used by programs, and are regarded as if they were not only an implementation of something in the C language, but also de facto part of the operating system interface. Unix-like operating systems generally cannot function if the C library is erased. This is true for applications which are dynamically as opposed to statically linked. Further, the kernel itself (at least in the case of Linux) operates independently of any libraries.
On Microsoft Windows, the core system dynamic libraries (DLLs) provide an implementation of the C standard library for the Microsoft Visual C++ compiler v6.0; the C standard library for newer versions of the Microsoft Visual C++ compiler is provided by each compiler individually, as well as redistributable packages. Compiled applications written in C are either statically linked with a C library, or linked to a dynamic version of the library that is shipped with these applications, rather than relied upon to be present on the targeted systems. Functions in a compiler’s C library are not regarded as interfaces to Microsoft Windows.
Many other implementations exist, provided with both various operating systems and C compilers. Some of the popular implementations are the following:
- BSD libc, implementations distributed under BSD operating systems
- GNU C Library (glibc), used in GNU Hurd, GNU/kFreeBSD and Linux
- Microsoft C run-time library, part of Microsoft Visual C++
- dietlibc, an alternative small implementation of the C standard library (MMU-less)
- μClibc, a C standard library for embedded μClinux systems (MMU-less)
- Newlib, a C standard library for embedded systems (MMU-less)
- klibc, primarily for booting Linux systems
- musl, another lightweight C standard library implementation for Linux systems
- Bionic, originally developed by Google for the Android embedded system operating system, derived from BSD libc.
Advantages of Using C library functions
- They work
One of the most important reasons you should use library functions is simply because they work. These functions have gone through multiple rigorous testing and are easy to use.
- The functions are optimized for performance
Since, the functions are “standard library” functions, a dedicated group of developers constantly make them better. In the process, they are able to create the most efficient code optimized for maximum performance.
- It saves considerable development time
Since the general functions like printing to a screen, calculating the square root, and many more are already written. You shouldn’t worry about creating them once again.
- The functions are portable
With ever-changing real-world needs, your application is expected to work every time, everywhere. And, these library functions help you in that they do the same thing on every computer.