1 .\" Copyright (C) 2007, 2010 Gabor Kovesdan. All rights reserved.
2 .\" Copyright (C) 2021 Faraz Vahedi <kfv@kfv.io>
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40 .Nd The C programming language
42 C is a general purpose programming language, which has a strong connection
43 with the UNIX operating system and its derivatives, since the vast
44 majority of those systems were written in the C language.
45 The C language contains some basic ideas from the BCPL language through
46 the B language written by Ken Thompson in 1970 for the DEC PDP-7 machines.
47 The development of the UNIX operating system was started on a PDP-7
48 machine in assembly language, but it made very difficult to port the existing
49 code to other systems.
51 In 1972 Dennis M. Ritchie worked out the C programming language for
52 further development of the UNIX operating system.
53 The idea was to implement only the C compiler for different
54 platforms, and implement most part of the operating system
55 in the new programming language to simplify the portability between
56 different architectures.
57 It follows that C is very eligible for (but not limited to) writing
58 operating systems and low-level applications.
60 The C language did not have a specification or standardized version for
62 It went through a lot of changes and improvements for ages.
63 In 1978, Brian W. Kernighan and Dennis M. Ritchie published the
64 first book about C under the title "The C Programming Language".
65 We can think of this book as the first specification of the language.
66 This version is often referred as K&R C after the names of the authors.
67 Sometimes it is referred as C78, as well, after the publishing year of
68 the first edition of the book.
70 It is important to notice, that the instruction set of the language is
71 limited to the most fundamental elements for simplicity.
72 Handling of the standard I/O and such common functions are implemented in
73 the libraries shipped with the compiler.
74 As these functions are also widely used, it was demanded to include into
75 the description what requisites the library should conform to, not just
76 strictly the language itself.
77 Accordingly, the aforementioned standards cover the library elements, as well.
78 The elements of this standard library is still not enough for more
80 In this case the provided system calls of the given operating system can be
82 To not lose the portability by using these system calls, the POSIX
83 (Portable Operating System Interface) standard evolved.
84 It describes what functions should be available to keep portability.
85 Note, that POSIX is not a C standard, but an operating system standard
86 and thus is beyond the scope of this manual.
87 The standards discussed below are all C standards and only cover
88 the C programming language and the accompanying library.
89 All listed improvements for each standard edition are taken from the official
91 For further details, check the publicly available drafts or
92 purchase the published standards \(em from either ISO or IEC resources.
94 After the publication of the book mentioned before,
95 the American National Standards Institute (ANSI) started to work on
96 standardizing the language, and they announced ANSI X3.159-1989
98 It is usually referred to as ANSI C or C89.
99 The main difference in this standard were the function prototypes,
100 which is a new way of declaring functions.
101 With the old-style function declarations, the compiler was unable to
102 check the sanity of the actual parameters at a function call.
103 The old syntax was highly error-prone because incompatible parameters
104 were hard to detect in the program code and the problem only showed up
107 In 1990, the International Organization for Standardization (ISO) adopted
108 the ANSI standard as ISO/IEC 9899:1990 in 1990.
109 This is also referred to as ISO C or C90.
110 It only contains negligible minor modifications against ANSI C,
111 so the two standards often considered to be fully equivalent.
112 This was a very important milestone in the history of the C language, but the
113 development of the language did not stop.
115 The ISO C standard was later extended with an amendment as
116 ISO/IEC 9899/AMD1 in 1995.
117 This contained, for example, the wide-character support in <wchar.h> and
118 <wctype.h>, and also restricted character set support via diagraphs and
120 This amendment is usually referred to as C95.
121 Two technical corrigenda were also published: Technical Corrigendum 1 as
122 ISO/IEC 9899/COR1 in 1994 and Technical Corrigendum 2 as ISO/IEC 9899/COR2
124 The continuous development and growth made it necessary to work out a new
125 standard, which contains the new features and fixes the known defects and
126 deficiencies of the language.
127 As a result, ISO/IEC 9899:1999 was born in 1999 as the second edition of the
129 Similarly to the other standards, this is informally named after the
130 publication year as C99.
131 The improvements include (but are not limited to) the following:
132 .Bl -bullet -offset indent
134 digraphs, trigraphs, and alternative spellings for the operators that
135 use non-ISO646 characters in <iso646.h>
137 extended multibyte and wide character library support in <wchar.h> and
140 variable length arrays
142 flexible array members
144 complex (and imaginary) number arithmetic support in <complex.h>
146 type-generic math macros in <tgmath.h>
148 the long long int type and library functions
150 remove implicit int type
152 universal character names (\eu and \eU)
156 remove implicit function declaration
158 BCPL style single-line comments
160 allow mixed declarations and code
162 the vscanf family of functions in <stdio.h> and <wchar.h>
164 allow trailing comma in enum declaration
168 the snprintf family of functions in <stdio.h>
170 boolean type and macros in <stdbool.h>
172 empty macro arguments
174 _Pragma preprocessing operator
176 __func__ predefined identifier
178 va_copy macro in <stdarg.h>
180 additional strftime conversion specifiers
183 Later in 2011, the third edition of the standard, ISO/IEC 1989:2011,
184 commonly referred to as C11 (formerly C1x), came out and replaced the
185 second edition by ISO/IEC 9899:1999/COR1:2001, ISO/IEC 9899:1999/COR2:2004,
186 and ISO/IEC 9899:1999/COR3:2007.
187 The improvements include (but are not limited to) the following:
188 .Bl -bullet -offset indent
190 support for multiple threads of execution and atomic operations in <threads.h>
193 additional floating-point characteristic macros in <float.h>
195 querying and specifying alignment of objects in <stdalign.h> and <stdlib.h>
197 Unicode character types and functions in <uchar.h>
199 type-generic expressions
201 static assertions in <assert.h>
203 anonymous structures and unions
205 remove the gets function from <stdio.h>
207 add the aligned_alloc, at_quick_exit, and quick_exit functions in <stdlib.h>
210 C11 was later superseded by ISO/IEC 9899:2018, also known as C17 which was
211 prepared in 2017 and published in June 2018 as the fourth edition.
212 It incorporates the Technical Corrigendum 1 (ISO/IEC 9899:2011/COR1:2012)
213 which was published in 2012.
214 It addressed defects and deficiencies in C11 without introducing new features,
215 only corrections and clarifications.
216 Since there were no major changes in C17, the current standard for
217 Programming Language C, is still considered C11 \(em ISO/IEC 9899:2011, published
220 The next standard, the fifth, is currently referred to as C2x and is scheduled
221 to be adopted by the end of 2021, with a publication date of 2022.
222 When published, it will cancel and replace the fourth edition, ISO/IEC
225 Some useful features have been provided as extensions by some compilers, but
226 they cannot be considered as standard features.
228 ISO/IEC JTC1/SC22/WG14 committee is responsible for the ISO/IEC 9899,
237 .%T X3.159-1989 (aka C89 or ANSI C)
242 .%T 9899:1990 (aka C90)
247 .%T 9899:1990/AMD 1:1995, Amendment 1: C Integrity (aka C95)
252 .%T 9899:1990/COR 1:1994, Technical Corrigendum 1
257 .%T 9899:1990/COR 2:1996, Technical Corrigendum 2
262 .%T 9899:1999 (aka C99)
267 .%T 9899:1999/COR 1:2001, Technical Corrigendum 1
272 .%T 9899:1999/COR 2:2004, Technical Corrigendum 2
277 .%T 9899:1999/COR 3:2007, Technical Corrigendum 3
282 .%T TR 24731-1:2007 (aka bounds-checking interfaces)
287 .%T TS 18037:2008 (aka, embedded C)
292 .%T TR 24747:2009 (aka mathematical special functions)
297 .%T TR 24732:2009 (aka decimal floating-point)
302 .%T TR 24731-2:2010 (aka dynamic allocation functions)
307 .%T 9899:2011 (aka C11)
312 .%T 9899:2011/COR 1:2012, Technical Corrigendum 1
317 .%T TS 17961:2013 (aka C secure coding rules)
322 .%T TS 18861-1:2014 (aka binary floating-point)
327 .%T TS 18861-2:2015 (aka decimal floating-point)
332 .%T TS 18861-3:2015 (aka interchange and extended types)
337 .%T TS 18861-4:2015 (aka supplementary functions)
342 .%T TS 17961:2013/COR 1:2016 (aka C secure coding rules TC1)
347 .%T TS 18861-5:2016 (aka supplementary attributes)
352 .%T 9899:2018 (aka C17)
355 This manual page first appeared in
359 This manual page was originally written by
360 .An Gabor Kovesdan Aq Mt gabor@FreeBSD.org .
364 .An Faraz Vahedi Aq Mt kfv@kfv.io
365 with information about more recent C standards.