CStandard Library Header Files

The interface to the C++ Standard Library consists of 87 header files, 26 of which present the C Standard Library. It’s often difficult to remember which header files you need to include in your source code, so this appendix provides a brief description of the contents of each header, organized into eight categories:

  • The C Standard Library
  • Containers
  • Algorithms, iterators, and allocators
  • General utilities
  • Mathematical utilities
  • Exceptions
  • I/O streams
  • Threading support library

THE C STANDARD LIBRARY

The C++ Standard Library includes almost the entire C Standard Library. The header files are generally the same, except for two points:

  • The header names are <cname> instead of <name.h>.
  • All the names declared in the <cname> header files are in the std namespace.

The following table provides a summary of the most useful functionality. Note that it’s recommended to avoid using C functionality, and instead use equivalent C++ features whenever possible.

HEADER FILENAME CONTENTS
<cassert> assert() macro
<ccomplex> Only includes <complex>. This header is deprecated since C++17.
<cctype> Character predicates and manipulation functions, such as isspace() and tolower()
<cerrno> Defines ...

Get Professional C++, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.