ArticleslgStudy

science

C standard library

C standard library is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand C standard library rather than just read about it. In short: The C standard library, sometimes referred to as libc, is the standard library for the C programming language specified in the ISO C standard. Starting from the original ANSI C standard, it was developed at the same time as the C POSIX library, which is a superset of it.

Key takeaways

  • C standard library belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect C standard library to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of C standard library from memory before moving on to harder problems.

Reference excerpt

The C standard library, sometimes referred to as libc, is the standard library for the C programming language specified in the ISO C standard. Starting from the original ANSI C standard, it was developed at the same time as the C POSIX library, 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 and includes macros, type definitions and functions for tasks such as string manipulation, mathematical computation, input/output processing, memory management, and input/output.

Application programming interface (API)

Header files The application programming interface (API) of the C standard library is declared in a number of header files. Each header file contains one or more function declarations, data type definitions, and macros. An implementation of a version of the standard for the C language can be described as hosted or freestanding. A hosted implementation supports the entire standard, and requires that all of the header files specified in the standard be present; these are typically implementations for programs running on an operating system. A freestanding implementation is not required to implement language features in the C library other than those specified in that version of the operating system as being required in freestanding implementations; these are typically implementations for programs running on a very limited operating system or directly on the hardware. After a long period of stability, three new header files (<iso646.h>, <wchar.h>, and <wctype.h>) were added with Normative Addendum 1 (NA1), an addition to the C Standard ratified in 1995. Six more header files (<complex.h>, <fenv.h>, <inttypes.h>, <stdbool.h>, <stdint.h>, and <tgmath.h>) were added with C99, a revision to the C Standard published in 1999, five more files (<stdalign.h>, <stdatomic.h>, <stdnoreturn.h>, <threads.h>, and <uchar.h>) with C11 in 2011, two more files (<stdbit.h> and <stdckdint.h>) with C23 in 2023, and two more files (<stdcountof.h> and <stdmchar.h>) in the upcoming C29, projected for 2029. In total, there are now 33 header files: Legend: : Deprecated : Removed

Three of the header files (<complex.h>, <stdatomic.h>, and <threads.h>) are conditional features that implementations are not required to support. The POSIX standard added several nonstandard C headers for Unix-specific functionality. Many have found their way to other architectures. Examples include <fcntl.h> and <unistd.h>. A number of other groups are using other nonstandard headers – the GNU C Library has <alloca.h>, and OpenVMS has the va_count() function.

Documentation On Unix-like systems, the authoritative documentation of the API is provided in the form of man pages. On most systems, man pages on standard library functions are in section 3; section 7 may contain some more generic pages on underlying concepts (e.g. man 7 math_error in Linux).

Implementations 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; in addition to functions specified by the C standard, it includes other functions that are part of the operating system API, such as functions specified in the POSIX standard. The C library 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 Microsoft C run-time library provides 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; the Windows system interfaces are provided in libraries separate from the C run-time library. Many C standard library implementations exist, provided with both various operating systems and C compilers. Some of the popular implementations are the following:

The BSD libc, various implementations distributed with BSD-derived operating systems GNU C Library (glibc), used in GNU Hurd, GNU/kFreeBSD, and most Linux distributions The Microsoft C run-time library, which is part of Microsoft Visual C++. There are two versions of the library: the formerly-redistributable (until Visual Studio 2013) MSVCRT which is not compliant to the C99 standard, and the newer UCRT (Universal C Run Time) shipped as part of Windows 10 and 11 which is C99-compliant [1]. dietlibc, an alternative small implementation of the C standard library (MMU-less) μClibc, a C standard library for embedded μClinux systems (MMU-less) uclibc-ng, an embedded C library, fork of μClibc, still maintained, with memory management unit (MMU) support Newlib, a C standard library for embedded systems (MMU-less) and used in the Cygwin GNU distribution for Windows 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 picolibc, developed by Keith Packard, targeting small embedded systems with limited RAM, based on code from Newlib and AVR Libc llvm-libc is a from-scratch implementation of the C standard library, built as part of the LLVM project

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with C standard library

Start with the simplest possible case. Write down what C standard library claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to C standard library before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about C standard library ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of C standard library

In research
C standard library appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses C standard library in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
C standard library is common in secondary-school and first-year university syllabi. It links to neighbouring topics C (programming language), C standard library, Programming languages standardized by POSIX, so understanding it makes those chapters shorter.
In everyday life
Look for C standard library outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “C standard library” →

How to study C standard library in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what C standard library means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain C standard library out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is C standard library in simple terms?

The C standard library, sometimes referred to as libc, is the standard library for the C programming language specified in the ISO C standard. Starting from the original ANSI C standard, it was developed at the same time as the C POSIX library, which is a superset of it.

Why does C standard library matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study C standard library?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on C standard library.

Tags

  • C (programming language)
  • C standard library
  • Programming languages standardized by POSIX
  • Programming languages with an ANSI standard

Keep exploring