Standard C

This document provides all the information you need to read and write programs in the Standard C programming language. It describes all aspects of Standard C that are the same on all implementations that conform to the standard for C. Whenever your goal is to produce code that is as portable as possible, this document tells you what you can count on. And by omission, it lets you know what you cannot count on -- nothing in this document is peculiar to any nonstandard dialect of C.

This document is intended as a comprehensive reference for the Standard C programming language, including its support library. In many ways, this material is best described by what it is not. It is not a history of the development of the language, nor is it a rationale for the current state of the language. Equally, this document is not a tutorial on Standard C, nor is it a lesson on how to write computer programs. It does not describe how to use any particular implementation of Standard C. Consult the documentation that comes with the particular translator (compiler or interpreter) that you are using for specific instructions on translating and executing programs.

Table of Contents

Introduction · Characters · Preprocessing · Syntax · Types · Declarations · Functions · Expressions · Portability

<assert.h> · <ctype.h> · <errno.h> · <float.h> · <iso646.h> · <limits.h> · <locale.h> · <math.h> · <setjmp.h> · <signal.h> · <stdarg.h> · <stddef.h> · <stdio.h> · <stdlib.h> · <string.h> · <time.h> · <wchar.h> · <wctype.h>

C Library Overview · Files and Streams · Formatted Output · Formatted Input

The Standard C language proper is what you write in C source files. It is best described at several levels of abstraction:

Introduction -- an overview of this document
Characters -- how to interpret character constants and string literals, and how to convert between multibyte characters and wide characters
Preprocessing -- how the translator processes directives and expands macros to produce the C tokens that constitute a translation unit
Syntax -- how the translator parses C tokens into one or more declarations
Types -- how the translator determines the properties of the types you specify within declarations, and how the program represents objects of various types
Declarations -- how the translator interprets the declarations you write to specify types and objects that the program manipulates
Functions -- how the translator interprets the declarations you write to specify the functions that encapsulate all executable code within a C program
Expressions -- how the translator interprets expressions to determine what computations to perform, either at translation time or when the program executes
Portability -- how to write code that is maximally portable across different implementations of Standard C

A C program can call on a large number of functions from the Standard C library. These functions perform essential services such as input and output. They also provide efficient implementations of frequently used operations. Numerous macro and type definitions accompany these functions to help you to make better use of the library. Most of the information about the Standard C library can be found in the descriptions of the standard headers that declare or define library entities for the program.

The 18 standard headers are:

<assert.h> -- for enforcing assertions when functions execute
<ctype.h> -- for classifying characters
<errno.h> -- for testing error codes reported by library functions
<float.h> -- for testing floating-point type properties
<iso646.h> -- for programming in ISO 646 variant character sets
<limits.h> -- for testing integer type properties
<locale.h> -- for adapting to different cultural conventions
<math.h> -- for computing common mathematical functions
<setjmp.h> -- for executing nonlocal goto statements
<signal.h> -- for controlling various exceptional conditions
<stdarg.h> -- for accessing a varying number of arguments
<stddef.h> -- for defining several useful types and macros
<stdio.h> -- for performing input and output
<stdlib.h> -- for performing a variety of operations
<string.h> -- for manipulating several kinds of strings
<time.h> -- for converting between various time and date formats
<wchar.h> -- for manipulating wide streams and several kinds of strings
<wctype.h> -- for classifying wide characters

Other information on the Standard C library includes:

C Library Overview -- how to use the library, including what happens at program startup and at program termination
Files and Streams -- how to read and write data between the program and files
Formatted Output -- how to generate text under control of a format string
Formatted Input -- how to scan and parse text under control of a format string

See also the Index.

Copyright © 1989-1996 by P.J. Plauger and Jim Brodie. All rights reserved.