Files
oldlinux-files/study/Ref-docs/C/index.html
2024-02-19 00:25:23 -05:00

200 lines
12 KiB
HTML

<HTML><HEAD><TITLE>Standard C</TITLE></HEAD><BODY BGCOLOR="#FFFFFF">
<H1><A NAME="Standard C">Standard C</A></H1><HR>
<P>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 <I>cannot</I>
count on -- nothing in this document is peculiar to any nonstandard
dialect of C.</P>
<P>This document is intended as a comprehensive <B>reference</B>
for the Standard C programming language, including its support
<B><A HREF="lib_over.html" tppabs="http://ccs.ucsd.edu/c/lib_over.html">library</A></B>. In many ways, this
material is best described by what it is <I>not</I>.
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
<B><A NAME="translator">translator</A></B> (compiler or interpreter)
that you are using for specific instructions on translating and executing
programs.</P>
<H2><A NAME="Table of Contents">Table of Contents</A></H2>
<P><B><CODE><A HREF="intro.html" tppabs="http://ccs.ucsd.edu/c/intro.html">Introduction</A>
&#183; <A HREF="charset.html" tppabs="http://ccs.ucsd.edu/c/charset.html">Characters</A>
&#183; <A HREF="preproc.html" tppabs="http://ccs.ucsd.edu/c/preproc.html">Preprocessing</A>
&#183; <A HREF="syntax.html" tppabs="http://ccs.ucsd.edu/c/syntax.html">Syntax</A>
&#183; <A HREF="types.html" tppabs="http://ccs.ucsd.edu/c/types.html">Types</A>
&#183; <A HREF="declare.html" tppabs="http://ccs.ucsd.edu/c/declare.html">Declarations</A>
&#183; <A HREF="function.html" tppabs="http://ccs.ucsd.edu/c/function.html">Functions</A>
&#183; <A HREF="express.html" tppabs="http://ccs.ucsd.edu/c/express.html">Expressions</A>
&#183; <A HREF="portable.html" tppabs="http://ccs.ucsd.edu/c/portable.html">Portability</A>
</CODE></B></P>
<P><B><CODE><A HREF="assert.html" tppabs="http://ccs.ucsd.edu/c/assert.html">&lt;assert.h&gt;</A>
&#183; <A HREF="ctype.html" tppabs="http://ccs.ucsd.edu/c/ctype.html">&lt;ctype.h&gt;</A>
&#183; <A HREF="errno.html" tppabs="http://ccs.ucsd.edu/c/errno.html">&lt;errno.h&gt;</A>
&#183; <A HREF="float.html" tppabs="http://ccs.ucsd.edu/c/float.html">&lt;float.h&gt;</A>
&#183; <A HREF="iso646.html" tppabs="http://ccs.ucsd.edu/c/iso646.html">&lt;iso646.h&gt;</A>
&#183; <A HREF="limits.html" tppabs="http://ccs.ucsd.edu/c/limits.html">&lt;limits.h&gt;</A>
&#183; <A HREF="locale.html" tppabs="http://ccs.ucsd.edu/c/locale.html">&lt;locale.h&gt;</A>
&#183; <A HREF="math.html" tppabs="http://ccs.ucsd.edu/c/math.html">&lt;math.h&gt;</A>
&#183; <A HREF="setjmp.html" tppabs="http://ccs.ucsd.edu/c/setjmp.html">&lt;setjmp.h&gt;</A>
&#183; <A HREF="signal.html" tppabs="http://ccs.ucsd.edu/c/signal.html">&lt;signal.h&gt;</A>
&#183; <A HREF="stdarg.html" tppabs="http://ccs.ucsd.edu/c/stdarg.html">&lt;stdarg.h&gt;</A>
&#183; <A HREF="stddef.html" tppabs="http://ccs.ucsd.edu/c/stddef.html">&lt;stddef.h&gt;</A>
&#183; <A HREF="stdio.html" tppabs="http://ccs.ucsd.edu/c/stdio.html">&lt;stdio.h&gt;</A>
&#183; <A HREF="stdlib.html" tppabs="http://ccs.ucsd.edu/c/stdlib.html">&lt;stdlib.h&gt;</A>
&#183; <A HREF="string.html" tppabs="http://ccs.ucsd.edu/c/string.html">&lt;string.h&gt;</A>
&#183; <A HREF="time.html" tppabs="http://ccs.ucsd.edu/c/time.html">&lt;time.h&gt;</A>
&#183; <A HREF="wchar.html" tppabs="http://ccs.ucsd.edu/c/wchar.html">&lt;wchar.h&gt;</A>
&#183; <A HREF="wctype.html" tppabs="http://ccs.ucsd.edu/c/wctype.html">&lt;wctype.h&gt;</A>
</CODE></B></P>
<P><B><CODE><A HREF="lib_over.html" tppabs="http://ccs.ucsd.edu/c/lib_over.html">C Library Overview</A>
&#183; <A HREF="lib_file.html" tppabs="http://ccs.ucsd.edu/c/lib_file.html">Files and Streams</A>
&#183; <A HREF="lib_prin.html" tppabs="http://ccs.ucsd.edu/c/lib_prin.html">Formatted Output</A>
&#183; <A HREF="lib_scan.html" tppabs="http://ccs.ucsd.edu/c/lib_scan.html">Formatted Input</A>
</CODE></B></P>
<HR>
<P>The Standard C language proper is what you write in C
<A HREF="charset.html#source file" tppabs="http://ccs.ucsd.edu/c/charset.html#source file">source files</A>. It is
best described at several levels of abstraction:</P>
<P><CODE><B><A HREF="intro.html" tppabs="http://ccs.ucsd.edu/c/intro.html">Introduction</A></B></CODE>
-- an overview of this document<BR>
<CODE><B><A HREF="charset.html" tppabs="http://ccs.ucsd.edu/c/charset.html">Characters</A></B></CODE>
-- how to interpret
<A HREF="charset.html#character constant" tppabs="http://ccs.ucsd.edu/c/charset.html#character constant">character constants</A> and
<A HREF="charset.html#string literal" tppabs="http://ccs.ucsd.edu/c/charset.html#string literal">string literals</A>, and how to
convert between
<A HREF="charset.html#Multibyte Characters" tppabs="http://ccs.ucsd.edu/c/charset.html#Multibyte Characters">multibyte characters</A> and
<A HREF="charset.html#Wide-Character Encoding" tppabs="http://ccs.ucsd.edu/c/charset.html#Wide-Character Encoding">wide characters</A>
<BR>
<CODE><B><A HREF="preproc.html" tppabs="http://ccs.ucsd.edu/c/preproc.html">Preprocessing</A></B></CODE>
-- how the translator processes directives and
<A HREF="preproc.html#Expanding Macros" tppabs="http://ccs.ucsd.edu/c/preproc.html#Expanding Macros">expands macros</A>
to produce the
<A HREF="syntax.html#C Tokens" tppabs="http://ccs.ucsd.edu/c/syntax.html#C Tokens">C tokens</A> that constitute a
<A HREF="preproc.html#translation unit" tppabs="http://ccs.ucsd.edu/c/preproc.html#translation unit">translation unit</A>
<BR>
<CODE><B><A HREF="syntax.html" tppabs="http://ccs.ucsd.edu/c/syntax.html">Syntax</A></B></CODE>
-- how the translator parses C tokens into one or more
<A HREF="syntax.html#Declaration Syntax" tppabs="http://ccs.ucsd.edu/c/syntax.html#Declaration Syntax">declarations</A>
<BR>
<CODE><B><A HREF="types.html" tppabs="http://ccs.ucsd.edu/c/types.html">Types</A></B></CODE>
-- how the translator determines the properties of the
types you specify within declarations,
and how the program represents objects of various types
<BR>
<CODE><B><A HREF="declare.html" tppabs="http://ccs.ucsd.edu/c/declare.html">Declarations</A></B></CODE>
-- how the translator interprets the declarations you write
to specify types and objects that the program manipulates
<BR>
<CODE><B><A HREF="function.html" tppabs="http://ccs.ucsd.edu/c/function.html">Functions</A></B></CODE>
-- how the translator interprets the declarations you write
to specify the functions that encapsulate all executable
code within a C program
<BR>
<CODE><B><A HREF="express.html" tppabs="http://ccs.ucsd.edu/c/express.html">Expressions</A></B></CODE>
-- how the translator interprets expressions to determine
what computations to perform, either at translation time
or when the program executes
<BR>
<CODE><B><A HREF="portable.html" tppabs="http://ccs.ucsd.edu/c/portable.html">Portability</A></B></CODE>
-- how to write code that is maximally portable across
different implementations of Standard C
</P>
<P>A C program can call on a large number of functions from the
<B><A NAME="Standard C Library">Standard C library</A></B>.
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
<B><A HREF="lib_over.html#standard headers" tppabs="http://ccs.ucsd.edu/c/lib_over.html#standard headers">standard headers</A></B>
that declare or define library entities for the program.</P>
<P>The 18 standard headers are:</P>
<P><CODE><B><A HREF="assert.html" tppabs="http://ccs.ucsd.edu/c/assert.html">&lt;assert.h&gt;</A></B></CODE>
-- for enforcing assertions when functions execute<BR>
<CODE><B><A HREF="ctype.html" tppabs="http://ccs.ucsd.edu/c/ctype.html">&lt;ctype.h&gt;</A></B></CODE>
-- for classifying characters<BR>
<CODE><B><A HREF="errno.html" tppabs="http://ccs.ucsd.edu/c/errno.html">&lt;errno.h&gt;</A></B></CODE>
-- for testing error codes reported by library functions<BR>
<CODE><B><A HREF="float.html" tppabs="http://ccs.ucsd.edu/c/float.html">&lt;float.h&gt;</A></B></CODE>
-- for testing floating-point type properties<BR>
<CODE><B><A HREF="iso646.html" tppabs="http://ccs.ucsd.edu/c/iso646.html">&lt;iso646.h&gt;</A></B></CODE>
-- for programming in ISO 646 variant character sets<BR>
<CODE><B><A HREF="limits.html" tppabs="http://ccs.ucsd.edu/c/limits.html">&lt;limits.h&gt;</A></B></CODE>
-- for testing integer type properties<BR>
<CODE><B><A HREF="locale.html" tppabs="http://ccs.ucsd.edu/c/locale.html">&lt;locale.h&gt;</A></B></CODE>
-- for adapting to different cultural conventions<BR>
<CODE><B><A HREF="math.html" tppabs="http://ccs.ucsd.edu/c/math.html">&lt;math.h&gt;</A></B></CODE>
-- for computing common mathematical functions<BR>
<CODE><B><A HREF="setjmp.html" tppabs="http://ccs.ucsd.edu/c/setjmp.html">&lt;setjmp.h&gt;</A></B></CODE>
-- for executing nonlocal <I>goto</I> statements<BR>
<CODE><B><A HREF="signal.html" tppabs="http://ccs.ucsd.edu/c/signal.html">&lt;signal.h&gt;</A></B></CODE>
-- for controlling various exceptional conditions<BR>
<CODE><B><A HREF="stdarg.html" tppabs="http://ccs.ucsd.edu/c/stdarg.html">&lt;stdarg.h&gt;</A></B></CODE>
-- for accessing a varying number of arguments<BR>
<CODE><B><A HREF="stddef.html" tppabs="http://ccs.ucsd.edu/c/stddef.html">&lt;stddef.h&gt;</A></B></CODE>
-- for defining several useful types and macros<BR>
<CODE><B><A HREF="stdio.html" tppabs="http://ccs.ucsd.edu/c/stdio.html">&lt;stdio.h&gt;</A></B></CODE>
-- for performing input and output<BR>
<CODE><B><A HREF="stdlib.html" tppabs="http://ccs.ucsd.edu/c/stdlib.html">&lt;stdlib.h&gt;</A></B></CODE>
-- for performing a variety of operations<BR>
<CODE><B><A HREF="string.html" tppabs="http://ccs.ucsd.edu/c/string.html">&lt;string.h&gt;</A></B></CODE>
-- for manipulating several kinds of strings<BR>
<CODE><B><A HREF="time.html" tppabs="http://ccs.ucsd.edu/c/time.html">&lt;time.h&gt;</A></B></CODE>
-- for converting between various time and date formats<BR>
<CODE><B><A HREF="wchar.html" tppabs="http://ccs.ucsd.edu/c/wchar.html">&lt;wchar.h&gt;</A></B></CODE>
-- for manipulating
<A HREF="lib_file.html#wide stream" tppabs="http://ccs.ucsd.edu/c/lib_file.html#wide stream">wide streams</A> and
several kinds of strings<BR>
<CODE><B><A HREF="wctype.html" tppabs="http://ccs.ucsd.edu/c/wctype.html">&lt;wctype.h&gt;</A></B></CODE>
-- for classifying
<A HREF="charset.html#Wide-Character Encoding" tppabs="http://ccs.ucsd.edu/c/charset.html#Wide-Character Encoding">wide characters</A></P>
<P>Other information on the Standard C library includes:</P>
<P><B><A HREF="lib_over.html" tppabs="http://ccs.ucsd.edu/c/lib_over.html">C Library Overview</A></B> --
how to use the library, including what happens at
<A HREF="lib_over.html#program startup" tppabs="http://ccs.ucsd.edu/c/lib_over.html#program startup">program startup</A> and at
<A HREF="lib_over.html#program termination" tppabs="http://ccs.ucsd.edu/c/lib_over.html#program termination">program termination</A>
<BR>
<B><A HREF="lib_file.html" tppabs="http://ccs.ucsd.edu/c/lib_file.html">Files and Streams</A></B> --
how to read and write data between the program and
<A HREF="lib_file.html#files" tppabs="http://ccs.ucsd.edu/c/lib_file.html#files">files</A>
<BR>
<B><A HREF="lib_prin.html" tppabs="http://ccs.ucsd.edu/c/lib_prin.html">Formatted Output</A></B> --
how to generate text under control of a
<A HREF="lib_prin.html#format string" tppabs="http://ccs.ucsd.edu/c/lib_prin.html#format string">format string</A>
<BR>
<B><A HREF="lib_scan.html" tppabs="http://ccs.ucsd.edu/c/lib_scan.html">Formatted Input</A></B> --
how to scan and parse text under control of a
<A HREF="lib_prin.html#format string" tppabs="http://ccs.ucsd.edu/c/lib_prin.html#format string">format string</A>
</P>
<HR>
<P>See also the
<B><A HREF="_index.html" tppabs="http://ccs.ucsd.edu/c/_index.html">Index</A></B>.</P>
<P><I>
<A HREF="crit_pb.html" tppabs="http://ccs.ucsd.edu/c/crit_pb.html">Copyright</A> &#169; 1989-1996
by P.J. Plauger and Jim Brodie. All rights reserved.</I></P>
</BODY></HTML>